New (sort of): Writing a FWImage to disk as a PNG, JPEG, or GIF

Just a note of some new functions that were added to the Actions API in 5.5. This set of global functions will write the contents of an FWImage to disk. The functions are:

fwWritePNG(path, image, palette, colourDepth, maxColours, dithered, progressive)
fwWriteGIF(path, image, palette, colourDepth, maxColours, dithered, progressive)
fwWriteJPEG(path, image, palette, colourDepth, maxColours, dithered, progressive, jpegQuality)

The parameters are as follows:

(string) path: The full path of the file to save
(FWImage) image: The image to write to file
(int) palette: The colour palette to use for output (0: adaptive palette, 1:system palette, 2:internet palette; only relevant for less than millions of colours; use adaptive if millions)
(int) colourDepth: The colour depth to use for output (0: indexed palette, 1: millions)
(int) maxColours: Maximum number of colours to use (only relevant for indexed palette; for millions, use 256 for this parameter)
(bool) dithered: Dither the image?
(bool) interlaced: Output the image as interlaced

(int) jpegQuality: Output quality for JPEGs (range 0-100)

Cheers

Stewart


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Please put these on the Wiki!

Thanks,

Walter

On Nov 8, 2011, at 5:51 AM, stewart wrote:

Just a note of some new functions that were added to the Actions API in 5.5. This set of global functions will write the contents of an FWImage to disk. The functions are:

fwWritePNG(path, image, palette, colourDepth, maxColours, dithered, progressive)
fwWriteGIF(path, image, palette, colourDepth, maxColours, dithered, progressive)
fwWriteJPEG(path, image, palette, colourDepth, maxColours, dithered, progressive, jpegQuality)

The parameters are as follows:

(string) path: The full path of the file to save
(FWImage) image: The image to write to file
(int) palette: The colour palette to use for output (0: adaptive palette, 1:system palette, 2:internet palette; only relevant for less than millions of colours; use adaptive if millions)
(int) colourDepth: The colour depth to use for output (0: indexed palette, 1: millions)
(int) maxColours: Maximum number of colours to use (only relevant for indexed palette; for millions, use 256 for this parameter)
(bool) dithered: Dither the image?
(bool) interlaced: Output the image as interlaced

(int) jpegQuality: Output quality for JPEGs (range 0-100)

Cheers

Stewart


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Done and done.

On 8 Nov 2011, at 12:52, Walter Lee Davis wrote:

Please put these on the Wiki!

Thanks,

Walter

On Nov 8, 2011, at 5:51 AM, stewart wrote:

Just a note of some new functions that were added to the Actions API in 5.5. This set of global functions will write the contents of an FWImage to disk. The functions are:

fwWritePNG(path, image, palette, colourDepth, maxColours, dithered, progressive)
fwWriteGIF(path, image, palette, colourDepth, maxColours, dithered, progressive)
fwWriteJPEG(path, image, palette, colourDepth, maxColours, dithered, progressive, jpegQuality)

The parameters are as follows:

(string) path: The full path of the file to save
(FWImage) image: The image to write to file
(int) palette: The colour palette to use for output (0: adaptive palette, 1:system palette, 2:internet palette; only relevant for less than millions of colours; use adaptive if millions)
(int) colourDepth: The colour depth to use for output (0: indexed palette, 1: millions)
(int) maxColours: Maximum number of colours to use (only relevant for indexed palette; for millions, use 256 for this parameter)
(bool) dithered: Dither the image?
(bool) interlaced: Output the image as interlaced

(int) jpegQuality: Output quality for JPEGs (range 0-100)

Cheers

Stewart


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi,
got any examples of this working to share? Thanks.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Another question - I’ve been experimenting with using this as a way to scale images in Freeway. However, I’ve run into a problem with it.

Despite putting the width and height dimensions I want in the SVG file, it’s scaling my image to the dimensions I want, BUT outputting the whole thing to a PNG the size of the object on the Freeway page. How do I stop it doing this? I want the final PNG to be the size width and height I’ve specified in the SVG markup.

I expect a trip to the command line to achieve the dimensions I want, but I’m hoping that this is something I don’t have to do.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Got it:

myImage = new FWImage( myData , targetWidth,targetHeight);

and then pass myImage to fwWritePNG()


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options