Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
koldo is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Icon at right side of the menuBar
Next Topic: GetExifThumbnail doc
Goto Forum:
  


Current Time: Sat Apr 20 02:18:27 CEST 2024

Total time taken to generate the page: 0.06458 seconds