comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Writing PNG file in pure IDL with metadata
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Writing PNG file in pure IDL with metadata [message #92160 is a reply to message #92146] Wed, 21 October 2015 10:13 Go to previous messageGo to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Tuesday, October 20, 2015 at 5:28:09 AM UTC-6, andrew...@gmail.com wrote:
> On Tuesday, 20 October 2015 21:53:42 UTC+10:30, Mark Hadfield wrote:
>> On Tuesday, 20 October 2015 20:39:13 UTC+13, andrew...@gmail.com wrote:
>>> Hi All,
>>>
>>> I have a bunch of Canon RAW .CR2 files that I'd like to transmogrify
>>> into PNG files with nice informative metadata embedded in them.
>>>
>>> Unfortunately IDL's inbuilt READ_PNG and WRITE_PNG don't know that PNG files can take metadata, and it looks like I'll be old, fat and bald before they do.
>>> Wait, I am old, fat and bald... :-(
>>>
>>> Anyway, I wondering if anyone has invented this particular wheel before.
>>> I'd be happy to work with a pure IDL write routine, or some method of Spawning off a command to a 3rd party program.
>>>
>>> TIA,
>>>
>>> Andrew
>>
>> ImageMagick should do this:
>>
>> http://www.imagemagick.org/Usage/basics/#attributes
>>
>> It's available on Linux, obviously, and on Windows via Cygwin. I haven't used ImageMagick for this purpose but I do regularly use it from IDL for format conversion (usually on windows via Cygwin).
>
> Thanks Mark. I was thinking I'd have to wait for a reply until the Yanks woke up, but I forgot about you worthy New Zealanders... ;-)
>
> Andrew

Andrew,

Though I can't share it, I wrote a procedure that supports writing both zTXt and tEXt to existing PNG files in fewer than 200 lines of IDL including lots of comments. It could be reduced even more with ZLIB_COMPRESS that was introduced to IDL since my original effort. I had to hack that with a temp file using /COMPRESS at the time.

The only remotely tricky part of the code is the application of the CRC. You can find the reference C implementation of the CRC here in Section 3.4: http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html#CR C-algorithm

I'd bet you can slap together a working version in less than an hour, which is significantly less time than you might wait for the feature to show up in a released version of IDL.

Jim P
"I work for Harris, but speak not for the Corporation"
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL and GPU
Next Topic: Making an array of only the first number of each row in a file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:13:48 PDT 2025

Total time taken to generate the page: 0.00354 seconds