png-8

Convert 32 bit png to 8 bit png with ImageMagick by preserving semi transparent pixels

早过忘川 提交于 2020-01-01 02:31:13
问题 I want to convert 32 bit png to 8 bit png with ImageMagick, but semi transparent pixels are lost. How to solve this problem? The command that I am using is the following convert original.png PNG8:output.png 回答1: Apparently, even though the PNG format actually allows any and all of the colors in an 8-bit indexed color PNG to be fully or partially transparent, ImageMagick's "PNG8" format specifier only supports GIF-style 1-bit transparency. It's possible to produce indexed 8-bit PNGs using

PHP gdLib 8-Bit PNG with alpha

元气小坏坏 提交于 2019-12-08 17:07:37
问题 how is it possible to save my image, created with gd, as an png-8? it saves as gif with transparent channel well - but I want to use png-8. Best Regards, Beerweasle 回答1: Using imagesavealpha() and a transparent bg color should do the trick... Based on dfilkovi's code: <?php // Create a new true color image $im = new imagecreatetruecolor(100, 100); // Fill with alpha background $alphabg = imagecolorallocatealpha($im, 0, 0, 0, 127); imagefill($im, 0, 0, $alphabg); // Convert to palette-based

Convert 32 bit png to 8 bit png with ImageMagick by preserving semi transparent pixels

这一生的挚爱 提交于 2019-12-03 06:19:12
I want to convert 32 bit png to 8 bit png with ImageMagick, but semi transparent pixels are lost. How to solve this problem? The command that I am using is the following convert original.png PNG8:output.png Apparently, even though the PNG format actually allows any and all of the colors in an 8-bit indexed color PNG to be fully or partially transparent, ImageMagick's "PNG8" format specifier only supports GIF-style 1-bit transparency. It's possible to produce indexed 8-bit PNGs using ImageMagick by not using the PNG8: specifier, but simply using -colors 256 or -colors 255 * to reduce the number

What is difference between png8 and png24

 ̄綄美尐妖づ 提交于 2019-12-03 02:55:19
问题 I want to know about uses of png files. There are two formats available for png images ; one is png8 and the another one is png24 . I would like to know that if I use either type in my html page, will there be any error? Or is this only quality matter? 回答1: There is only one PNG format, but it supports 5 color types. PNG-8 refers to palette variant, which supports only 256 colors, but is usually smaller in size. PNG-8 can be a GIF substitute. PNG-24 refers to true color variant, which

What is difference between png8 and png24

风格不统一 提交于 2019-12-02 16:29:12
I want to know about uses of png files. There are two formats available for png images ; one is png8 and the another one is png24 . I would like to know that if I use either type in my html page, will there be any error? Or is this only quality matter? There is only one PNG format, but it supports 5 color types . PNG-8 refers to palette variant, which supports only 256 colors, but is usually smaller in size. PNG-8 can be a GIF substitute. PNG-24 refers to true color variant, which supports more colors, but might be bigger. PNG-24 can be used instead of JPEG, if lossless image format is needed.

Create and write paletted RGBA PNG using NSImage

ぐ巨炮叔叔 提交于 2019-12-01 14:08:43
I'm trying to create paletted PNG image (8-bit per pixel) that uses RGBA palette (32-bit per palette entry) using Cocoa framework*. I've tried few combinations for [NSBitmapImageRep initWithBitmapDataPlanes:…] method. It seems to create appropriate bitmap for bitsPerSample:2 bitsPerPixel:8 . However, when I try to write such bitmap with [NSBitmapImageRep representationUsingType:NSPNGFileType…] I get: libpng error: Invalid bit depth for RGBA image If I try other bit depths, then I get 32-bit per pixel (non-paletted) image. *) I know I could just use libpng , but that's not an answer I'm looking

Create and write paletted RGBA PNG using NSImage

99封情书 提交于 2019-12-01 12:43:47
问题 I'm trying to create paletted PNG image (8-bit per pixel) that uses RGBA palette (32-bit per palette entry) using Cocoa framework*. I've tried few combinations for [NSBitmapImageRep initWithBitmapDataPlanes:…] method. It seems to create appropriate bitmap for bitsPerSample:2 bitsPerPixel:8 . However, when I try to write such bitmap with [NSBitmapImageRep representationUsingType:NSPNGFileType…] I get: libpng error: Invalid bit depth for RGBA image If I try other bit depths, then I get 32-bit

How to convert PNG to 8-bit PNG using PHP GD library

久未见 提交于 2019-11-30 09:27:41
I want to write a routine which takes PNG image path as parameter and convert that image into 8-bit PNG image. I need to use PHP GD library for this. To convert any PNG image to 8-bit PNG use this function, I've just created function convertPNGto8bitPNG () function convertPNGto8bitPNG ($sourcePath, $destPath) { $srcimage = imagecreatefrompng($sourcePath); list($width, $height) = getimagesize($sourcePath); $img = imagecreatetruecolor($width, $height); $bga = imagecolorallocatealpha($img, 0, 0, 0, 127); imagecolortransparent($img, $bga); imagefill($img, 0, 0, $bga); imagecopy($img, $srcimage, 0,

How to convert PNG to 8-bit PNG using PHP GD library

牧云@^-^@ 提交于 2019-11-29 14:27:48
问题 I want to write a routine which takes PNG image path as parameter and convert that image into 8-bit PNG image. I need to use PHP GD library for this. 回答1: To convert any PNG image to 8-bit PNG use this function, I've just created function convertPNGto8bitPNG () function convertPNGto8bitPNG ($sourcePath, $destPath) { $srcimage = imagecreatefrompng($sourcePath); list($width, $height) = getimagesize($sourcePath); $img = imagecreatetruecolor($width, $height); $bga = imagecolorallocatealpha($img,