Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » How to set the dpi (dots per inch) of an image
Re: How to set the dpi (dots per inch) of an image [message #27584 is a reply to message #27562] |
Sat, 24 July 2010 11:08 |
|
koldo
Messages: 3356 Registered: August 2008
|
Senior Veteran |
|
|
luzr wrote on Fri, 23 July 2010 11:37 |
koldo wrote on Mon, 19 July 2010 04:03 |
luzr wrote on Sat, 17 July 2010 09:58 |
koldo wrote on Thu, 15 July 2010 05:07 | Hello all
I have loaded a scanned image, processed it and saved it. The original image had 300 x 300 dpi, but saved image has 96 x 96 dpi.
Is it possible to set the saved image to 300 x 300 dpi?
|
RasterEncoder::SetDots - you set the "physical" dimensions of Image there.
The only problem is that real encoder has to use this value. I did now a quick review, looks like bmp and png do, jpg has it commented out for whatever reason, gif ignores the value. But all seems to provide it for Raster::GetInfo.
Mirek
|
Hello Mirek
I have tested it only with .png files using different SetDots values and the result is always the same:
- In Microsoft Paint it always appears 96 dpi hor. and 96 dpi vert.
- In XnView, it is like there is no resolution info (while original unprocessed .png file has dpi info).
|
Do you think you can look into the issue?
I believe that what is missing is just one call to
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Desktop-gene ric/LSB-Desktop-generic/libpng12.png.set.phys.1.html
in
void PNGEncoder::Data::Start(Stream& stream, Size size_, int bpp, ImageKind kind_, bool interlace_,
Mirek
|
Hello Mirek
You have do it all. Adding this in Start function it works:
unsigned xdpi = 300;
unsigned ydpi = 300;
unsigned xres = unsigned(xdpi / 0.0254 + 0.5);
unsigned yres = unsigned(ydpi / 0.0254 + 0.5);
png_set_pHYs(png_ptr, info_ptr, xres, yres, PNG_RESOLUTION_METER);
The question is how to set xdpy and ydpi in U++ code.
Best regards
IƱaki
|
|
|
|
|
How to set the dpi (dots per inch) of an image
By: koldo on Thu, 15 July 2010 11:07
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: mirek on Sat, 17 July 2010 09:58
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Mon, 19 July 2010 10:03
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: mirek on Fri, 23 July 2010 11:37
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Sat, 24 July 2010 11:08
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Mon, 26 July 2010 09:50
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: mirek on Fri, 13 August 2010 11:13
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Fri, 13 August 2010 13:46
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Sun, 22 August 2010 23:51
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: mirek on Wed, 08 September 2010 09:17
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Fri, 10 September 2010 11:41
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Fri, 10 September 2010 13:42
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: mirek on Mon, 13 September 2010 17:33
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Mon, 13 September 2010 21:56
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Tue, 14 September 2010 09:51
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Wed, 15 September 2010 09:17
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Wed, 15 September 2010 13:38
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Wed, 15 September 2010 15:02
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: mirek on Thu, 16 September 2010 23:49
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Fri, 17 September 2010 09:58
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Fri, 17 September 2010 10:39
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: mirek on Fri, 17 September 2010 20:17
|
|
|
Re: How to set the dpi (dots per inch) of an image
By: koldo on Fri, 17 September 2010 22:29
|
Goto Forum:
Current Time: Sat Apr 20 02:18:27 CEST 2024
Total time taken to generate the page: 0.06458 seconds
|