JP2 conversion-resolution

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

Richiek_1970
Posts: 3
Joined: Mon Dec 07, 2015 9:27 am

JP2 conversion-resolution

Post by Richiek_1970 »

Hello, I am needing to convert a lot of 16 bit, 300 dpi images to JP2 format, the software is turning them to 72 dpi and 8 bit, how can I avoid this?
I need the JP2's to be the same resolution and I can't find a setting for this........
Thanks in advance,

Rich.
User avatar
xnview
Author of XnView
Posts: 44883
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: JP2 conversion-resolution

Post by xnview »

There is no 16bits support
Pierre.
Richiek_1970
Posts: 3
Joined: Mon Dec 07, 2015 9:27 am

Re: JP2 conversion-resolution

Post by Richiek_1970 »

Hi Pierre,
Thanks for your answer, but can I make 300 dpi JP2's?
Richiek_1970
Posts: 3
Joined: Mon Dec 07, 2015 9:27 am

Re: JP2 conversion-resolution

Post by Richiek_1970 »

Hello, Further to my previous question, it appears that the JP2 files I have produced are NOT valid. Also, if I run an action in Photoshop to change the resolution to 300 dpi, it then changes back to 72 dpi, what is going on here?????


SO I ask again, can this software make files that are 300 dpi? If it cannot then I don't see that anyone can seriously use it can they?
User avatar
XnTriq
Moderator & Librarian
Posts: 6387
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: JP2 conversion-resolution

Post by XnTriq »

XnView uses OpenJPEG's codec for reading and writing JP2 files. Does the plug-in provide support for storing the Resolution Box info, Pierre?
Ive (borland.public.delphi.graphics » [url=https://groups.google.com/d/topic/borland.public.delphi.graphics/LkqyyaLNSWM/discussion]JPeg2000 Fiile Format DPI Info[/url]) wrote:files with a simple jpeg2000 code stream (usually the file has the extension .j2k) do not define any information about dpi settings, but the jpeg2000 file format (with the extension .jp2) does define so called "jp2 boxes" and supports any kind of additional information. But most of them are only optional and not present within every jp2 file. Anyway, if the DPI info is present it is defined by the "resc"-box, and as you are using a 3rd party library and do not need to mess around with all the header stuff, I think a simple way would be just to search the file for the "resc" string (thats what I mean with the IsBoxPresent function) and if the string is present you can use the following code to get the DPI for both x and y resolution.

Code: Select all

const
  jp2_resc = $72657363;  // 'resc'
  InchPerMeter = 39.37007874016;

type
  TJp2_resc = packed record
    hNum: word;
    hDen: word;
    vNum: word;
    vDen: word;
    hExp: ShortInt;
    vExp: ShortInt;
  end;

var
  FhDpi, FvDpi: integer;   // horizontal and vertical dpi setting

procedure Jp2ReadDpi;
var
  resc: TJp2_resc;
begin
  if IsBoxPresent(jp2_resc)  then begin
    FStream.Read(resc, SizeOf(TJp2_resc));    // FStream is the jp2 file
    FhDpi := round((resc.hNum/resc.hDen)*power(10,resc.hExp)/InchPerMeter);
    FvDpi := round((resc.vNum/resc.vDen)*power(10,resc.vExp)/InchPerMeter);
  end;
end;
IGN ([url=http://professionnels.ign.fr/sites/default/files/DT_JPEG2000.pdf]Diffusion raster au format JPEG2000[/url] » Exigences de conformité géoréférencement imagerie) wrote:Format de fichier image : présence minimale des boîtes du format JP2
obligatoires : "jP", "ftyp", "jp2h", "ihdr", "colr" et "jp2c"
optionnelles : "bpcc", "cdef", "res", "resc" et "resd"
paramètre BR de la boîte ftyp vaut ‘jpx\040’
MinV (Minor version of the ISO-15444-1 specification): 0
compatibility list (CL) : ‘jp2\040’ ou ‘jpx\040’ (dépend de l’utilisation de l’opacité ou non) et ’J2P1’ (profil 1)
User avatar
xnview
Author of XnView
Posts: 44883
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: JP2 conversion-resolution

Post by xnview »

currently jp2 dpi resolution is not saved...
Pierre.