What is the difference between QImage and QPixmap?
I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap?
c++ qt qimage qpixmap
add a comment |
I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap?
c++ qt qimage qpixmap
I'm not sure if I understand your question, but I thought it was pretty clear in the documentation: "QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen." doc.qt.nokia.com/latest/qpixmap.html#details
– cgmb
Apr 25 '12 at 0:45
1
yeah! i had find it out,but not understand well, for example, optimized for I/O and optimized for showing, it is difference a picutre showed on difference platform ? ..Can you help me make a step to explain.. thank you..
– Mr.Tu
Apr 25 '12 at 0:50
I'm still not 100% sure I know what you mean, but if you're using QWidgets, you can display it in a QLabel. If you're using QGraphicsView, you can display it in a QGraphicsPixmapItem. If you're using QML the Image element will handle everything for you.
– cgmb
Apr 25 '12 at 1:17
Let me put it another way, what is the Engine, what is its work? when to use it?
– Mr.Tu
Apr 25 '12 at 1:29
add a comment |
I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap?
c++ qt qimage qpixmap
I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap?
c++ qt qimage qpixmap
c++ qt qimage qpixmap
edited Nov 30 '17 at 7:51
Aquarius_Girl
6,99439146275
6,99439146275
asked Apr 25 '12 at 0:30
Mr.Tu
92761942
92761942
I'm not sure if I understand your question, but I thought it was pretty clear in the documentation: "QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen." doc.qt.nokia.com/latest/qpixmap.html#details
– cgmb
Apr 25 '12 at 0:45
1
yeah! i had find it out,but not understand well, for example, optimized for I/O and optimized for showing, it is difference a picutre showed on difference platform ? ..Can you help me make a step to explain.. thank you..
– Mr.Tu
Apr 25 '12 at 0:50
I'm still not 100% sure I know what you mean, but if you're using QWidgets, you can display it in a QLabel. If you're using QGraphicsView, you can display it in a QGraphicsPixmapItem. If you're using QML the Image element will handle everything for you.
– cgmb
Apr 25 '12 at 1:17
Let me put it another way, what is the Engine, what is its work? when to use it?
– Mr.Tu
Apr 25 '12 at 1:29
add a comment |
I'm not sure if I understand your question, but I thought it was pretty clear in the documentation: "QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen." doc.qt.nokia.com/latest/qpixmap.html#details
– cgmb
Apr 25 '12 at 0:45
1
yeah! i had find it out,but not understand well, for example, optimized for I/O and optimized for showing, it is difference a picutre showed on difference platform ? ..Can you help me make a step to explain.. thank you..
– Mr.Tu
Apr 25 '12 at 0:50
I'm still not 100% sure I know what you mean, but if you're using QWidgets, you can display it in a QLabel. If you're using QGraphicsView, you can display it in a QGraphicsPixmapItem. If you're using QML the Image element will handle everything for you.
– cgmb
Apr 25 '12 at 1:17
Let me put it another way, what is the Engine, what is its work? when to use it?
– Mr.Tu
Apr 25 '12 at 1:29
I'm not sure if I understand your question, but I thought it was pretty clear in the documentation: "QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen." doc.qt.nokia.com/latest/qpixmap.html#details
– cgmb
Apr 25 '12 at 0:45
I'm not sure if I understand your question, but I thought it was pretty clear in the documentation: "QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen." doc.qt.nokia.com/latest/qpixmap.html#details
– cgmb
Apr 25 '12 at 0:45
1
1
yeah! i had find it out,but not understand well, for example, optimized for I/O and optimized for showing, it is difference a picutre showed on difference platform ? ..Can you help me make a step to explain.. thank you..
– Mr.Tu
Apr 25 '12 at 0:50
yeah! i had find it out,but not understand well, for example, optimized for I/O and optimized for showing, it is difference a picutre showed on difference platform ? ..Can you help me make a step to explain.. thank you..
– Mr.Tu
Apr 25 '12 at 0:50
I'm still not 100% sure I know what you mean, but if you're using QWidgets, you can display it in a QLabel. If you're using QGraphicsView, you can display it in a QGraphicsPixmapItem. If you're using QML the Image element will handle everything for you.
– cgmb
Apr 25 '12 at 1:17
I'm still not 100% sure I know what you mean, but if you're using QWidgets, you can display it in a QLabel. If you're using QGraphicsView, you can display it in a QGraphicsPixmapItem. If you're using QML the Image element will handle everything for you.
– cgmb
Apr 25 '12 at 1:17
Let me put it another way, what is the Engine, what is its work? when to use it?
– Mr.Tu
Apr 25 '12 at 1:29
Let me put it another way, what is the Engine, what is its work? when to use it?
– Mr.Tu
Apr 25 '12 at 1:29
add a comment |
5 Answers
5
active
oldest
votes
Easilly answered by reading the docs on QImage and QPixmap:
The QPixmap class is an off-screen image representation that can be used as a paint device.
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
Edit: Also, from @Dave's answer:
You can't manipulate a QPixmap outside the GUI-thread, but QImage has no such restriction.
And from @Arnold:
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it,
etc., use a QImage.
- If you plan to draw the same image more than once
on the screen, convert it to a QPixmap.
thanks for your help... what is general process that QPixmpa and QImage load a picture.. what is it in memory.. thank you..
– Mr.Tu
Apr 26 '12 at 2:46
I'm not sure what you are trying to do, but in this question I demonstrate how to load YV12 data from the disk, convert to RGB using a GLSL fragment shader, and then display it on the screen inside a QImage. I guess I could point you to right direction if you were more clear about what you are trying to accomplish.
– karlphillip
Apr 26 '12 at 3:13
Thank for your answer.
– Mr.Tu
Apr 26 '12 at 4:03
7
Does this really answer anything?
– spinkus
Jun 27 '14 at 3:43
2
Just copying documentation and others' answers doesn't make sense.
– Viacheslav Kroilov
Mar 16 '18 at 16:31
add a comment |
There is a nice series of articles at Qt Labs that explains a lot about the Qt graphics system. This article in particular has a section on QImage
vs. QPixmap
.
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it, etc., use a
QImage
. - If you plan to draw the same image more than once on the screen, convert it to a
QPixmap
.
thank you. This passage tell us: there are two different way to load a picture, raster and OpenGL ? is right?
– Mr.Tu
Apr 26 '12 at 2:50
I don't quite understand the question. Neither "raster" nor "OpenGL" specifically represent ways to load a picture.
– Arnold Spence
Apr 26 '12 at 3:16
add a comment |
One important difference is that you cannot create or manipulate a QPixmap
on anything but the main GUI thread. You can, however, create and manipulate QImage
instances on background threads and then convert them after passing them back to the GUI thread.
add a comment |
Important in industrial environments:
The QPixmap is stored on the video card doing the display. Not the QImage.
So if you have a server running the application, and a client station doing the display, it is very significant in term of network usage.
With a Pixmap, a Redraw consists in sending only the order to redraw (a few bytes) over the network.
With a QImage, it consists in sending the whole image (around a few MB).
add a comment |
QPixmap
is an "image object" whosepixel
representation are of no consequence in your code, Thus QPixmap is designed and optimized for rendering images on display screen, it is stored on the XServer when using X11, thus drawing QPixmap on XWindow is much faster than drawing QImages, as the data is already on the server, and ready to use.
When to use QPixmap: If you just want to draw an existing image (icon .. background .. etc) especially repeatedly, then use QPixmap.
QImage is an "array of pixels in memory" of the client code, QImage is designed and optimized for I/O, and for direct pixel access and manipulation.
When to use QImage: If you want to draw, with Qpaint, or manipulate an image pixels.
QBitmap is only a convenient QPixmap subclass ensuring a depth of 1, its a monochrome (1-bit depth) pixmap. Just like QPixmap , QBitmap is optimized for use of implicit data sharing.
QPicture is a paint device that records and replays QPainter commands -- your drawing --
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10307860%2fwhat-is-the-difference-between-qimage-and-qpixmap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Easilly answered by reading the docs on QImage and QPixmap:
The QPixmap class is an off-screen image representation that can be used as a paint device.
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
Edit: Also, from @Dave's answer:
You can't manipulate a QPixmap outside the GUI-thread, but QImage has no such restriction.
And from @Arnold:
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it,
etc., use a QImage.
- If you plan to draw the same image more than once
on the screen, convert it to a QPixmap.
thanks for your help... what is general process that QPixmpa and QImage load a picture.. what is it in memory.. thank you..
– Mr.Tu
Apr 26 '12 at 2:46
I'm not sure what you are trying to do, but in this question I demonstrate how to load YV12 data from the disk, convert to RGB using a GLSL fragment shader, and then display it on the screen inside a QImage. I guess I could point you to right direction if you were more clear about what you are trying to accomplish.
– karlphillip
Apr 26 '12 at 3:13
Thank for your answer.
– Mr.Tu
Apr 26 '12 at 4:03
7
Does this really answer anything?
– spinkus
Jun 27 '14 at 3:43
2
Just copying documentation and others' answers doesn't make sense.
– Viacheslav Kroilov
Mar 16 '18 at 16:31
add a comment |
Easilly answered by reading the docs on QImage and QPixmap:
The QPixmap class is an off-screen image representation that can be used as a paint device.
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
Edit: Also, from @Dave's answer:
You can't manipulate a QPixmap outside the GUI-thread, but QImage has no such restriction.
And from @Arnold:
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it,
etc., use a QImage.
- If you plan to draw the same image more than once
on the screen, convert it to a QPixmap.
thanks for your help... what is general process that QPixmpa and QImage load a picture.. what is it in memory.. thank you..
– Mr.Tu
Apr 26 '12 at 2:46
I'm not sure what you are trying to do, but in this question I demonstrate how to load YV12 data from the disk, convert to RGB using a GLSL fragment shader, and then display it on the screen inside a QImage. I guess I could point you to right direction if you were more clear about what you are trying to accomplish.
– karlphillip
Apr 26 '12 at 3:13
Thank for your answer.
– Mr.Tu
Apr 26 '12 at 4:03
7
Does this really answer anything?
– spinkus
Jun 27 '14 at 3:43
2
Just copying documentation and others' answers doesn't make sense.
– Viacheslav Kroilov
Mar 16 '18 at 16:31
add a comment |
Easilly answered by reading the docs on QImage and QPixmap:
The QPixmap class is an off-screen image representation that can be used as a paint device.
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
Edit: Also, from @Dave's answer:
You can't manipulate a QPixmap outside the GUI-thread, but QImage has no such restriction.
And from @Arnold:
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it,
etc., use a QImage.
- If you plan to draw the same image more than once
on the screen, convert it to a QPixmap.
Easilly answered by reading the docs on QImage and QPixmap:
The QPixmap class is an off-screen image representation that can be used as a paint device.
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
Edit: Also, from @Dave's answer:
You can't manipulate a QPixmap outside the GUI-thread, but QImage has no such restriction.
And from @Arnold:
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it,
etc., use a QImage.
- If you plan to draw the same image more than once
on the screen, convert it to a QPixmap.
edited Dec 10 '14 at 15:47
sashoalm
29.4k67244510
29.4k67244510
answered Apr 25 '12 at 12:37
karlphillip
73.8k26184349
73.8k26184349
thanks for your help... what is general process that QPixmpa and QImage load a picture.. what is it in memory.. thank you..
– Mr.Tu
Apr 26 '12 at 2:46
I'm not sure what you are trying to do, but in this question I demonstrate how to load YV12 data from the disk, convert to RGB using a GLSL fragment shader, and then display it on the screen inside a QImage. I guess I could point you to right direction if you were more clear about what you are trying to accomplish.
– karlphillip
Apr 26 '12 at 3:13
Thank for your answer.
– Mr.Tu
Apr 26 '12 at 4:03
7
Does this really answer anything?
– spinkus
Jun 27 '14 at 3:43
2
Just copying documentation and others' answers doesn't make sense.
– Viacheslav Kroilov
Mar 16 '18 at 16:31
add a comment |
thanks for your help... what is general process that QPixmpa and QImage load a picture.. what is it in memory.. thank you..
– Mr.Tu
Apr 26 '12 at 2:46
I'm not sure what you are trying to do, but in this question I demonstrate how to load YV12 data from the disk, convert to RGB using a GLSL fragment shader, and then display it on the screen inside a QImage. I guess I could point you to right direction if you were more clear about what you are trying to accomplish.
– karlphillip
Apr 26 '12 at 3:13
Thank for your answer.
– Mr.Tu
Apr 26 '12 at 4:03
7
Does this really answer anything?
– spinkus
Jun 27 '14 at 3:43
2
Just copying documentation and others' answers doesn't make sense.
– Viacheslav Kroilov
Mar 16 '18 at 16:31
thanks for your help... what is general process that QPixmpa and QImage load a picture.. what is it in memory.. thank you..
– Mr.Tu
Apr 26 '12 at 2:46
thanks for your help... what is general process that QPixmpa and QImage load a picture.. what is it in memory.. thank you..
– Mr.Tu
Apr 26 '12 at 2:46
I'm not sure what you are trying to do, but in this question I demonstrate how to load YV12 data from the disk, convert to RGB using a GLSL fragment shader, and then display it on the screen inside a QImage. I guess I could point you to right direction if you were more clear about what you are trying to accomplish.
– karlphillip
Apr 26 '12 at 3:13
I'm not sure what you are trying to do, but in this question I demonstrate how to load YV12 data from the disk, convert to RGB using a GLSL fragment shader, and then display it on the screen inside a QImage. I guess I could point you to right direction if you were more clear about what you are trying to accomplish.
– karlphillip
Apr 26 '12 at 3:13
Thank for your answer.
– Mr.Tu
Apr 26 '12 at 4:03
Thank for your answer.
– Mr.Tu
Apr 26 '12 at 4:03
7
7
Does this really answer anything?
– spinkus
Jun 27 '14 at 3:43
Does this really answer anything?
– spinkus
Jun 27 '14 at 3:43
2
2
Just copying documentation and others' answers doesn't make sense.
– Viacheslav Kroilov
Mar 16 '18 at 16:31
Just copying documentation and others' answers doesn't make sense.
– Viacheslav Kroilov
Mar 16 '18 at 16:31
add a comment |
There is a nice series of articles at Qt Labs that explains a lot about the Qt graphics system. This article in particular has a section on QImage
vs. QPixmap
.
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it, etc., use a
QImage
. - If you plan to draw the same image more than once on the screen, convert it to a
QPixmap
.
thank you. This passage tell us: there are two different way to load a picture, raster and OpenGL ? is right?
– Mr.Tu
Apr 26 '12 at 2:50
I don't quite understand the question. Neither "raster" nor "OpenGL" specifically represent ways to load a picture.
– Arnold Spence
Apr 26 '12 at 3:16
add a comment |
There is a nice series of articles at Qt Labs that explains a lot about the Qt graphics system. This article in particular has a section on QImage
vs. QPixmap
.
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it, etc., use a
QImage
. - If you plan to draw the same image more than once on the screen, convert it to a
QPixmap
.
thank you. This passage tell us: there are two different way to load a picture, raster and OpenGL ? is right?
– Mr.Tu
Apr 26 '12 at 2:50
I don't quite understand the question. Neither "raster" nor "OpenGL" specifically represent ways to load a picture.
– Arnold Spence
Apr 26 '12 at 3:16
add a comment |
There is a nice series of articles at Qt Labs that explains a lot about the Qt graphics system. This article in particular has a section on QImage
vs. QPixmap
.
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it, etc., use a
QImage
. - If you plan to draw the same image more than once on the screen, convert it to a
QPixmap
.
There is a nice series of articles at Qt Labs that explains a lot about the Qt graphics system. This article in particular has a section on QImage
vs. QPixmap
.
Here's a short summary that usually (not always) applies:
- If you plan to manipulate an image, modify it, change pixels on it, etc., use a
QImage
. - If you plan to draw the same image more than once on the screen, convert it to a
QPixmap
.
edited Mar 21 '17 at 2:58
Innokentiy Alaytsev
639517
639517
answered Apr 25 '12 at 4:28
Arnold Spence
18.3k56165
18.3k56165
thank you. This passage tell us: there are two different way to load a picture, raster and OpenGL ? is right?
– Mr.Tu
Apr 26 '12 at 2:50
I don't quite understand the question. Neither "raster" nor "OpenGL" specifically represent ways to load a picture.
– Arnold Spence
Apr 26 '12 at 3:16
add a comment |
thank you. This passage tell us: there are two different way to load a picture, raster and OpenGL ? is right?
– Mr.Tu
Apr 26 '12 at 2:50
I don't quite understand the question. Neither "raster" nor "OpenGL" specifically represent ways to load a picture.
– Arnold Spence
Apr 26 '12 at 3:16
thank you. This passage tell us: there are two different way to load a picture, raster and OpenGL ? is right?
– Mr.Tu
Apr 26 '12 at 2:50
thank you. This passage tell us: there are two different way to load a picture, raster and OpenGL ? is right?
– Mr.Tu
Apr 26 '12 at 2:50
I don't quite understand the question. Neither "raster" nor "OpenGL" specifically represent ways to load a picture.
– Arnold Spence
Apr 26 '12 at 3:16
I don't quite understand the question. Neither "raster" nor "OpenGL" specifically represent ways to load a picture.
– Arnold Spence
Apr 26 '12 at 3:16
add a comment |
One important difference is that you cannot create or manipulate a QPixmap
on anything but the main GUI thread. You can, however, create and manipulate QImage
instances on background threads and then convert them after passing them back to the GUI thread.
add a comment |
One important difference is that you cannot create or manipulate a QPixmap
on anything but the main GUI thread. You can, however, create and manipulate QImage
instances on background threads and then convert them after passing them back to the GUI thread.
add a comment |
One important difference is that you cannot create or manipulate a QPixmap
on anything but the main GUI thread. You can, however, create and manipulate QImage
instances on background threads and then convert them after passing them back to the GUI thread.
One important difference is that you cannot create or manipulate a QPixmap
on anything but the main GUI thread. You can, however, create and manipulate QImage
instances on background threads and then convert them after passing them back to the GUI thread.
answered Apr 25 '12 at 12:22
Dave Mateer
12.7k1277131
12.7k1277131
add a comment |
add a comment |
Important in industrial environments:
The QPixmap is stored on the video card doing the display. Not the QImage.
So if you have a server running the application, and a client station doing the display, it is very significant in term of network usage.
With a Pixmap, a Redraw consists in sending only the order to redraw (a few bytes) over the network.
With a QImage, it consists in sending the whole image (around a few MB).
add a comment |
Important in industrial environments:
The QPixmap is stored on the video card doing the display. Not the QImage.
So if you have a server running the application, and a client station doing the display, it is very significant in term of network usage.
With a Pixmap, a Redraw consists in sending only the order to redraw (a few bytes) over the network.
With a QImage, it consists in sending the whole image (around a few MB).
add a comment |
Important in industrial environments:
The QPixmap is stored on the video card doing the display. Not the QImage.
So if you have a server running the application, and a client station doing the display, it is very significant in term of network usage.
With a Pixmap, a Redraw consists in sending only the order to redraw (a few bytes) over the network.
With a QImage, it consists in sending the whole image (around a few MB).
Important in industrial environments:
The QPixmap is stored on the video card doing the display. Not the QImage.
So if you have a server running the application, and a client station doing the display, it is very significant in term of network usage.
With a Pixmap, a Redraw consists in sending only the order to redraw (a few bytes) over the network.
With a QImage, it consists in sending the whole image (around a few MB).
edited Nov 28 '18 at 14:28
answered Jun 6 '13 at 8:19
iksess
31937
31937
add a comment |
add a comment |
QPixmap
is an "image object" whosepixel
representation are of no consequence in your code, Thus QPixmap is designed and optimized for rendering images on display screen, it is stored on the XServer when using X11, thus drawing QPixmap on XWindow is much faster than drawing QImages, as the data is already on the server, and ready to use.
When to use QPixmap: If you just want to draw an existing image (icon .. background .. etc) especially repeatedly, then use QPixmap.
QImage is an "array of pixels in memory" of the client code, QImage is designed and optimized for I/O, and for direct pixel access and manipulation.
When to use QImage: If you want to draw, with Qpaint, or manipulate an image pixels.
QBitmap is only a convenient QPixmap subclass ensuring a depth of 1, its a monochrome (1-bit depth) pixmap. Just like QPixmap , QBitmap is optimized for use of implicit data sharing.
QPicture is a paint device that records and replays QPainter commands -- your drawing --
add a comment |
QPixmap
is an "image object" whosepixel
representation are of no consequence in your code, Thus QPixmap is designed and optimized for rendering images on display screen, it is stored on the XServer when using X11, thus drawing QPixmap on XWindow is much faster than drawing QImages, as the data is already on the server, and ready to use.
When to use QPixmap: If you just want to draw an existing image (icon .. background .. etc) especially repeatedly, then use QPixmap.
QImage is an "array of pixels in memory" of the client code, QImage is designed and optimized for I/O, and for direct pixel access and manipulation.
When to use QImage: If you want to draw, with Qpaint, or manipulate an image pixels.
QBitmap is only a convenient QPixmap subclass ensuring a depth of 1, its a monochrome (1-bit depth) pixmap. Just like QPixmap , QBitmap is optimized for use of implicit data sharing.
QPicture is a paint device that records and replays QPainter commands -- your drawing --
add a comment |
QPixmap
is an "image object" whosepixel
representation are of no consequence in your code, Thus QPixmap is designed and optimized for rendering images on display screen, it is stored on the XServer when using X11, thus drawing QPixmap on XWindow is much faster than drawing QImages, as the data is already on the server, and ready to use.
When to use QPixmap: If you just want to draw an existing image (icon .. background .. etc) especially repeatedly, then use QPixmap.
QImage is an "array of pixels in memory" of the client code, QImage is designed and optimized for I/O, and for direct pixel access and manipulation.
When to use QImage: If you want to draw, with Qpaint, or manipulate an image pixels.
QBitmap is only a convenient QPixmap subclass ensuring a depth of 1, its a monochrome (1-bit depth) pixmap. Just like QPixmap , QBitmap is optimized for use of implicit data sharing.
QPicture is a paint device that records and replays QPainter commands -- your drawing --
QPixmap
is an "image object" whosepixel
representation are of no consequence in your code, Thus QPixmap is designed and optimized for rendering images on display screen, it is stored on the XServer when using X11, thus drawing QPixmap on XWindow is much faster than drawing QImages, as the data is already on the server, and ready to use.
When to use QPixmap: If you just want to draw an existing image (icon .. background .. etc) especially repeatedly, then use QPixmap.
QImage is an "array of pixels in memory" of the client code, QImage is designed and optimized for I/O, and for direct pixel access and manipulation.
When to use QImage: If you want to draw, with Qpaint, or manipulate an image pixels.
QBitmap is only a convenient QPixmap subclass ensuring a depth of 1, its a monochrome (1-bit depth) pixmap. Just like QPixmap , QBitmap is optimized for use of implicit data sharing.
QPicture is a paint device that records and replays QPainter commands -- your drawing --
edited Aug 4 '18 at 9:29
answered Feb 14 '18 at 8:01
Mohammad Kanan
2,657101327
2,657101327
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10307860%2fwhat-is-the-difference-between-qimage-and-qpixmap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'm not sure if I understand your question, but I thought it was pretty clear in the documentation: "QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen." doc.qt.nokia.com/latest/qpixmap.html#details
– cgmb
Apr 25 '12 at 0:45
1
yeah! i had find it out,but not understand well, for example, optimized for I/O and optimized for showing, it is difference a picutre showed on difference platform ? ..Can you help me make a step to explain.. thank you..
– Mr.Tu
Apr 25 '12 at 0:50
I'm still not 100% sure I know what you mean, but if you're using QWidgets, you can display it in a QLabel. If you're using QGraphicsView, you can display it in a QGraphicsPixmapItem. If you're using QML the Image element will handle everything for you.
– cgmb
Apr 25 '12 at 1:17
Let me put it another way, what is the Engine, what is its work? when to use it?
– Mr.Tu
Apr 25 '12 at 1:29