|
This is going to demonstrate the saving Gif with compression in PhotoController.
For Jpeg saving please read this.
Here is the source Gif photo.
File Size: 30.7KB
Use PhotoController to save this photo with 256 Standard color compression
type.
[C#]
objPC.Save( "Standard256.GIF" , CompressionType.GifStandard256
, 0 , PhotoFormat.Gif , false);
This code shows saving to a file named Standard256.Gif and using GifStandard256
compression type and setting that it is not transparent.
Below is the result:
File Size: 19.3 KB
Remark: We can see the color is different
in some place. That's because the new photo is saved with only 256 color
and other colors are lost.
Use PhotoController to save the original photo with 216 WebSafe compression
type.
[C#]
objPC.Save( "Websafe216.GIF" , CompressionType.GifWebSafe
, 0 , PhotoFormat.Gif , false);
Below is the result:
File Size: 12.7 KB
Remark: The size is more smaller,
because the new photo has only 216 color.
Use PhotoController to save the original photo with GifAdaptive compression
type.
[C#]
objPC.Save( "Adaptive.GIF" , CompressionType.GifAdaptive
, 0 , PhotoFormat.Gif , false);
Below is the result:
File Size:27.5KB
Remark: We can see the photo is more
clear but the size is not that satisfied. This compression type will create
a similar color table to the original one, so it will get a good effect
if the original photo has lots of similar colors.
Use PhotoController to save the original photo with GifOctreeQuantizer
compression type. GifOctreeQuantizer is a way which enables to specify
the color quality, from 1 to 256.
[C#]
objPC.Save( "filename" , CompressionType.GifOctreeQuantizer
, [Quality Value], PhotoFormat.Gif , false);
Below are three results:
When Quality is 256
File Size: 30.6KB
When Quality is 128
File Size:18.5KB
When Quality is 64
File Size:14.9KB
|