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 #92402 is a reply to message #92396] Tue, 08 December 2015 13:52 Go to previous messageGo to previous message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Monday, December 7, 2015 at 7:16:35 PM UTC-8, andrew...@gmail.com wrote:
> On Thursday, 22 October 2015 03:43:41 UTC+10:30, Jim P wrote:
>> 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"
>
> Thanks Jim,
>
> Yes, I eventually bit the bullet and wrote the whole kit 'n' kaboodle in IDL,
> without any calls to external libraries.
>
> So, it's not the fastest PNG writer you'll ever see, but it does write out
> a standard format Metadata header with our customised fields, and the resulting files can be read by 3rd party PNG readers.
>
> It would still be nice to see IDL handle metadata reading and writing for all image formats that support metadata.
>
> Cheers,
>
> Andrew

Andrew,

I'm impressed you went through with this. A question: what 3rd party applications have you encountered that can get at the metadata in a PNG file? The only one I know of is the aforementioned ImageMagick.
[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 13:55:27 PDT 2025

Total time taken to generate the page: 0.00360 seconds