• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 
22 November 2024, 01:56:02


Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by Galfar
 -  1 November 2011, 23:33:33
You can get print resolution from JPEGs (provided that this info is embedded inside) using metadata framework.
It's not stored in image itself so you need to keep track of it if you want to later save the values that were loaded.

Code (pascal) Select
type
  // defined in Imaging.pas
  TResolutionUnit = (
    ruSizeInMicroMeters, // value is pixel size in micrometers
    ruDpi,               // value is pixels/dots per inch
    ruDpm,               // value is pixels/dots per meter
    ruDpcm               // value is pixels/dots per centimeter
  );

var
  XRes, YRes: Single;
  ResUnit: TResolutionUnit;

... load image ...

ResUnit := ruDpi;
if GlobalMetadata.GetPhysicalPixelSize(ResUnit, XRes, YRes) then
begin
  ... print resolution present, do something with it
end;

... do something with image
GlobalMetadata.SetPhysicalPixelSize(ResUnit, XRes, YRes, True)
... save image


Checkout TMetadata class in Imaging.pas for implementation details.
Posted by davem
 -  1 November 2011, 11:44:59
Do I understand from this topic http://galfar.vevb.net/imaging/smf/index.php/topic,283.0.html that the library supports the print resolution of JPEGs (in pixels per inch or pixels per cm)? How to set it up? Thanks!
SMF spam blocked by CleanTalk