Images Miscolored

Mark Smith mark at
Fri Dec 14 08:01:15 EST 2007

Here's a function that should strip the gamma-correction out of a  
file. I can't see any before and after difference in the files I've  
tried it on, but maybe it could help. Also, be sure to try it on  
copies of your prcious files, as it over-writes the file it works on...

on stripGC pFile
     --check for the 'magic bytes' to make sure it's a .png
     repeat for each item i in "137,80,78,71,13,10,26,10"
         put numtochar(i) after magicStr
     end repeat
     put url ("binfile:" & pFile) into pngData
     if char 1 to 8 of pngData is not magicStr then exit stripGC

     -- find the gamma correction chunk
     set the casesensitive to true
     put offset("gAMA", pngData) - 4 into chunkStart
     if chunkStart = 0 then exit stripGC -- stop if it isn't there

     put empty into chunkDataLength
     get binarydecode("M",char chunkStart to chunkStart + 3 of  
pngData, chunkDataLength)
     delete char chunkStart to (chunkStart + chunkDataLength + 11)   
of pngData

     put pngData into url ("binfile:" & pFile)
end stripGC



On 14 Dec 2007, at 08:22, Scott Rossi wrote:

> Recently, Bridger Maxwell wrote:
>> A friend of mine cooked up a fix.  He created an automator action  
>> that
>> will change all the files from png to jpg by making a new jpg image
>> and pasting the png into it.  Apparently, when simply saving the png
>> to a jpg (from Preview) it does not solve the problem.  This is
>> definitely a Revolution problem, because the images display just fine
>> in every other program, but I don't even know how to submit a bug  
>> like
>> this when I am not sure what causes it or exactly why the fix works.
>> Can anyone give me a hint on this?
> As Jacque explained, it probably has to do with the reading (or lack
> thereof) of gamma information in the file.
> FWIW, you might want to see this post from September:
> Shift-to125
> 11893.html#a12511893
> Regards,
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design
> _______________________________________________
> use-revolution mailing list
> use-revolution at
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:

More information about the Use-livecode mailing list