WideImage 1.0 branch (discontinued)

WideImage Wiki : opAsPalette

MainPage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Support This Project SourceForge.net Logo
Important notice: the development of WideImage 1.0 branch is discontinued. Please visit http://wideimage.sourceforge.net for the new version of library and documentation.
This web site will remain accessible to serve as documentation for the old versions of the library. For help on migration, please refer to the migration guide.

wiImage::asPalette()

See: List of operations

Signature

wiImage::asPalette($nColors = 255, $dither = null, $matchPalette = true)

Parameters


Description

Returns a copy of itself, converted to wiPaletteImage. $nColors specifies the number of colors (max 255), $dither enables/disables mixdown dithering, $matchPalette specifies whether the palette should be corrected with imagecolormatch() after converting to a palette image.

Notes


As for $dither and $matchPalette, I've played with these two a lot and I'm not sure what are the best settings. This is what I found out (your experience may differ):

Examples

// load a truecolor png and save it as an 8-bit gif with dithering and no palette matching
$img = wiImage::load('/path/to/an/image.png');
$img->asPalette(255, true, false)->saveToFile('palette-image.png');



CategoryDocApi

There are no comments on this page. [Add comment]

WideImage - an Object-Oriented PHP Image Library for Image manipulation
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.0371 seconds