03-24-2010 06:15 AM - edited 03-24-2010 06:20 AM
Hi,
I want
to export a graph's image to a 300pdi-png (printing). Here's what I do:
First I export the graph to a png with the standard LV-VI. I re-open the file, locate the IHDR-Header, shift the index by 17 (which is the end of the IHDR) and place the pHYs-Header (from a 300pdi-PNG created by Photoshop)in between the IHDR and the IDAT, as required. (See Snipet; hope you don't mind the german captions ^^)
So far
so good, but the file gets corrupt after my modifications....guess I've done some mistakes here.
Greets,
Stoney
Solved! Go to Solution.
03-24-2010 08:16 AM
At the first, try to set "prepend array or string size? (T)" of the Write to Binary File primitive to false (its true by default), because this added 4 additional bytes at the beginning of the file and png header gets corrupted.
Andrey.
03-24-2010 08:18 AM
03-24-2010 08:25 AM
muks wrote:
Should it not be dpi instead of pdi
Hmmm... "Per Dot Inch" also not so bad. But "ipd" - this will be definitoively totally wrong!
03-24-2010 08:30 AM
03-24-2010 10:02 AM
Andrey Dmitriev wrote:
muks wrote:
Should it not be dpi instead of pdi
Hmmm... "Per Dot Inch" also not so bad. But "ipd" - this will be definitoively totally wrong!
ups, my bad....
Andrey Dmitriev wrote:At the first, try to set "prepend array or string size? (T)" of the Write to Binary File primitive to false (its true by default), because this added 4 additional bytes at the beginning of the file and png header gets corrupted.
Andrey.
Thanks, but the file is still corrupt...
03-24-2010 10:35 AM
Stone-D wrote:Thanks, but the file is still corrupt...
Not sure if other parts of the header should be changed or not (may be some offsets values should be corrected).
You have three possibilities in general:
1. Check byte to byte that your new file still compliant with RFC2083.
2. Use ImageMagick (something like "convert -units PixelsPerInch -density 300 inFile.png outFile.png")
3. Use libpng (as dll - this can be hard if you haven't experience with using external code in LabVIEW)
Andrey.
03-24-2010 10:57 AM