Re: struggling to save a tiff as a PNG and keep filesize down
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 14:15:04 -0800
On Thu, 28 Feb 2008 13:57:48 -0800, sklett <s@xxxxx> wrote:
[...]What happens if you create the new image instance as "new
Bitmap(pixelDimensions.Width, pixelDimensions.Height,
PixelFormat.Format1bppIndexed)"?
Hi Peter,
I thought of that as well, but when I try to use a 1bpp image and create a
Graphics instance from it I get the following exception:
"A Graphics object cannot be created from an image that has an indexed pixel
format."
Ah, right. I forgot about that limitation.
You could resize the image into a 24/32bpp image and then use LockBits() on that and a 1 bpp image to copy the data directly.
Photoshop is created a 32 BPP image. Very strange.
Are you sure it is? 3K seems awfully small for a file that really was saved as 32 bpp. At 800 x 1000, you're looking at over 3MB of data for a 32 bpp image. If so, that'd mean that PNG compression is achieving a 1000-to-1 compression ratio when you save from Photoshop.
Even JPEG wouldn't normally be able to save an image of that dimension without practically destroying the image, and PNG being lossless shouldn't be able to come anywhere close to that for a full-color image of any reasonable complexity (even the best-case scenarios that one might consider are unlikely IMHO and those require careful matching of the input data to the specific PNG compression algorithm being used).
It's hard to comment precisely without having a copy of the original bitmap and of the Photoshop-created image. But I still suspect this is a color depth issue.
Pete
.
- Follow-Ups:
- Re: struggling to save a tiff as a PNG and keep filesize down
- From: not_a_commie
- Re: struggling to save a tiff as a PNG and keep filesize down
- From: Steve K.
- Re: struggling to save a tiff as a PNG and keep filesize down
- References:
- struggling to save a tiff as a PNG and keep filesize down
- From: sklett
- Re: struggling to save a tiff as a PNG and keep filesize down
- From: Peter Duniho
- Re: struggling to save a tiff as a PNG and keep filesize down
- From: sklett
- struggling to save a tiff as a PNG and keep filesize down
- Prev by Date: Re: OT: Visual Studio with 3 developers and same projekt
- Next by Date: Re: Implement Interface IEnumerator and IEnumerable
- Previous by thread: Re: struggling to save a tiff as a PNG and keep filesize down
- Next by thread: Re: struggling to save a tiff as a PNG and keep filesize down
- Index(es):