JPNG

Richmond Mathewson richmondmathewson at gmail.com
Fri Aug 11 04:41:16 EDT 2017



On 8/11/17 11:13 am, Mark Waddingham via use-livecode wrote:
> On 2017-08-11 09:29, Richmond Mathewson via use-livecode wrote:
>> In theory that sounds both impressive and useful . . .
>>
>> But, what, apart from your stack can read the format/compression
>> method properly.
>
> I think Hermann's suggestion is a bespoke way of reducing resource 
> size for built apps and their content - as there isn't a 'standard' 
> for JPNG (yet) it isn't really useful for interchange between apps, 
> but it might be that a standard does appear at some point.
>
>> Can your stack export a JPNG image?
>
> It doesn't need to in order to be useful. This is something which 
> could be used at the point of building a standalone (in a 
> standaloneSaving handler, for example) to convert PNG images into a 
> smaller form for use by the app at runtime.
>
It may not, but the stack does export images with a .lcjpng suffix . . . 
and the question is what for?

Richmond.

>> "This may even result in a larger data size than the original when
>> decompressing."
>
> I'm not sure I quite understand that comment...
>
> Any (loss-less) compression algorithm will produce output which is 
> larger than the input for some inputs 
> (https://en.wikipedia.org/wiki/Lossless_compression#Limitations). So 
> all (such) compression algorithms tend to have a flag in their encoded 
> output which says 'this is not compressed'. When the compressor runs, 
> if the output is greater in size than the original input it just emits 
> the output with that flag and the original data. (In this case, if the 
> JPNG process produces a data size larger than the original PNG, just 
> use the original PNG!).
>
> In this case the JPNG idea exploits the fact that color images tend to 
> withstand data-loss, but alpha data (masks) do not - JPEG is lossy, it 
> removes information which our eyes cannot see. PNG compression (a 
> variant of gzip IIRC) is loss-less, it preserves the exact values of 
> the inputs. So you use the lossy method (JPEG) on the part of the 
> image which makes no difference to our eyes, and the loss-less method 
> (PNG) on the part of the image which our eyes would notice a 
> difference in.
>
> Warmest Regards,
>
> Mark.
>





More information about the use-livecode mailing list