save high resolution image
save high resolution image
Hi All,
I'm considering wxWidgets for a CAD type application but I need to produce high resolution images (300dpi or more png format ) of images that typically
drawn on the screen at much lower resolutions.
Can this be done? If yes, how would you do this using the wxWidgets?
Thanks in advance.
D. Fabrizio
I'm considering wxWidgets for a CAD type application but I need to produce high resolution images (300dpi or more png format ) of images that typically
drawn on the screen at much lower resolutions.
Can this be done? If yes, how would you do this using the wxWidgets?
Thanks in advance.
D. Fabrizio
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: save high resolution image
Quite old thread, but I have the same needing (ideally PNG in 300 dpi, even if user can choose to work with less of definition). And since I'm really not a graphic specialist (on dev side, I mean), I've some dummy questions in addition to your own :
Is it directly possible to change the definition (since I think dpi talks about definition, not resolution) using wxWidget ? Is it possible to test/check it for an existing image ?
And a main general question (not related to wxWidget, but maybe useful to be sure we talk about the same thing) : from what I know (what I see in Photoshop), a standard screen is 72 dpi (or between 72 and 96, not sure). So, if I have a 100 x 100 pixels image in 300 dpi, it will show a side of (100 * (300 / 72)) = 400 pixels on my monitor : is that right ?
Is it directly possible to change the definition (since I think dpi talks about definition, not resolution) using wxWidget ? Is it possible to test/check it for an existing image ?
And a main general question (not related to wxWidget, but maybe useful to be sure we talk about the same thing) : from what I know (what I see in Photoshop), a standard screen is 72 dpi (or between 72 and 96, not sure). So, if I have a 100 x 100 pixels image in 300 dpi, it will show a side of (100 * (300 / 72)) = 400 pixels on my monitor : is that right ?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: save high resolution image
wxImage::GetOptionInt / SetOptionIntIs it directly possible to change the definition (since I think dpi talks about definition, not resolution) using wxWidget ? Is it possible to test/check it for an existing image ?
Code: Select all
::wxInitAllImageHandlers();
wxImage img("d:\\test.png");
if(img.Ok()) {
int res_x = img.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
int res_y = img.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
int res_unit = img.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT );
wxLogMessage("%d %d %d", res_x, res_y, res_unit);
}
http://docs.wxwidgets.org/trunk/image_8 ... d9267c2729
The resolution in dpi is usually only relevant when a picture gets printed, it's just a matter of how the pixels are interpreted, it doesn't change the pixel data.
http://en.wikipedia.org/wiki/Dots_per_i ... mage_files
Actually modern screens have around 90-100 dpi. http://members.ping.de/~sven/dpi.htmla standard screen is 72 dpi (or between 72 and 96, not sure). So, if I have a 100 x 100 pixels image in 300 dpi, it will show a side of (100 * (300 / 72)) = 400 pixels on my monitor : is that right ?
Programs like photoshop usually work in zoom levels relative to the pixel size. So a 100x100 pixel image at 100% zoom, on a screen with 100dpi resolution would be 1x1 inch.
The output size of a 100x100 pixel image with 300 dpi would be 100/300 inch ~ 0.33 x 0.33 inch ~ 0.85 x 0.85 cm
So if you'd import that into a DTP application, the image would be that small by default.
Use the source, Luke!
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: save high resolution image
Thanks for your clarification, doublemax... Some points are clearly better defined in my mind, now. Also, I've a subsidiary question : is there a way to test the dpi of a given screen ? I mean through real testing, not just reading its documentation.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: save high resolution image
So, wxGetDisplayPPI(). Thanks Manolo. Also, meanwhile, I found wxDC::GetPPI().
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: save high resolution image
In Windows default screen resolution is set equal to 96 dpi, which is close to the resolution of of real monitors (pixel size around 0.265 mm).
72 DPI closer to the resolution of the classical photoprocess (picture size 10-12 cm (4-5 inches))
72 DPI closer to the resolution of the classical photoprocess (picture size 10-12 cm (4-5 inches))
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: save high resolution image
Hello amk_tt. Do you mean that even if a screen has a density of 72 pixels-per-inch, Windows will considers-it as a 96 dpi one ? I don't understand where the OS has an influence on screen characteristics...
If the OS decides in something and since you talk about Windows default, I suppose this value is modifiable : where ?
If the OS decides in something and since you talk about Windows default, I suppose this value is modifiable : where ?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: save high resolution image
Hmm, since Vista or Seven, effectively there is possibility to fine tune the DPI for text in the display settings... But it's just for text, no ?
--
EDIT : and, however, it doesn't change the DPI, but (as you told me at the beginning of the thread, doublemax), it changes the zoom to mimic a different dpi. The dpi (if I've well learned my lesson) is a physical density and can't be changed by soft (we can just compute a new image dimensions in pixels to fill-in a certain area on screen or paper).
--
EDIT : and, however, it doesn't change the DPI, but (as you told me at the beginning of the thread, doublemax), it changes the zoom to mimic a different dpi. The dpi (if I've well learned my lesson) is a physical density and can't be changed by soft (we can just compute a new image dimensions in pixels to fill-in a certain area on screen or paper).
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: save high resolution image
The (initial) purpose of this setting is to adjust it to the actual connected monitor. So if you have a monitor with 90dpi connected and Windows set to the correct value, e.g. a DIN A4 sheet in a DTP application would be the same size as a real sheet of paper you hold next to the monitor. (At 100% zoom).
Use the source, Luke!
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: save high resolution image
So, can I consider that Windows checks for the real device's DPI to define its 100% ? Does this value renewed in realtime (for example, when I change the monitor between sessions or on fly) ?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: save high resolution image
When a monitor is connected through an old VGA connector it wouldn't be possible for the PC to know the physical capabilities of the monitor. Over DVI or HDMI it could be possible, but i haven't found any information if it's actually done.So, can I consider that Windows checks for the real device's DPI to define its 100% ? Does this value renewed in realtime (for example, when I change the monitor between sessions or on fly) ?
At least on my system the Windows setting is 96dpi while my monitor (DVI) has around 90dpi. So i wouldn't rely on it too much.
Use the source, Luke!
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: save high resolution image
Hmm, OK, doublemax, I think I'll don't rely on too And thanks for your replies on this thread which goes far out of wxWidgets topic...
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]