Image Color Downsizing

Rick Harrison harrison at all-auctions.com
Tue Nov 27 10:19:08 EST 2012


Hi Thomas,

I was looking at export image late last night without much success.

If one exports to a variable and then sets the imageData to the variable
it comes out as a mishmash. 

I looked into your suggestion of "optimized" this morning and it complained
about the syntax.  I found out a couple of things to make it work.

1.  The term optimized is in the wrong position in the dictionary.

2,  Exporting to another image container instead of a variable works.

If you use as the dictionary suggests:

 export image to {file filePath | container} as {gif | png} with colorCount [optimized] color palette

so:

export "image1" to tImage as png with 16 optimized color palette

doesn't work.

If you use:

export image "Image1" to image "Image2" as png with 16 color optimized palette

it works!

Unfortunately according to the documentation, it won't work under iOS, so I guess
it's back to the drawing board.

Any other ideas?

Thanks,

Rick

On Nov 27, 2012, at 9:16 AM, Thomas McGrath III <mcgrath3 at mac.com> wrote:

> Rick,
> 
> Have you checked out "export with palette" in the dictionary? It works on the palette of the image which could be set to 16 color count?
> 
> export "image1" to tImage as png with 16 optimized color palette
> 
> If the optimized palette form is used, then a palette with the colorCount colors will be generated that does its best to approximate all the colors present in the image. The image will be color-matched to this palette before export. If colorList is not specified, a 256 entry palette will be generated. 
> 
> 
> export with palette
> 
> Type: command
> 
> Syntax: 
> export image to {file filePath | container} as {gif | png} with standard palette
> export image to {file filePath | container} as {gif | png} with optimized palette
> export image to {file filePath | container} as {gif | png} with colorCount [optimized] color palette
> export image to {file filePath | container} as {gif | png} with palette colorList
> 
> 
> -- Tom McGrath III
> http://lazyriver.on-rev.com
> 3mcgrath at comcast.net
> 
> On Nov 26, 2012, at 10:02 PM, Rick Harrison <harrison at all-auctions.com> wrote:
> 
>> Hi there,
>> 
>> I was wondering if anyone knew of a way to
>> downsize the colors of an image using LiveCode.
>> 
>> Example:  The incoming image has millions of colors,
>> and I want the color table of the image just to use 16 colors.
>> 
>> Any way to do this?  Suggestions?
>> 
>> Thanks,
>> 
>> Rick
>> 





More information about the use-livecode mailing list