png

How to convert this indexed PNG to grayscale and keep transparency, using Python and Pillow?

风格不统一 提交于 2019-12-21 22:47:21
问题 I am trying to convert images to grayscale using Python/Pillow. I had no difficulty in most images, but then, while testing with different images, I found this logo from the BeeWare project, that I know that has been further edited with some image editor and recompressed using ImageOptim. The image has some kind of transparency (in the whole white area around the bee), but black color gets messed up. Here is the code: #/usr/bin/env python3 import os from PIL import Image, ImageFile src_path =

Save a plot as PNG and PDF only by one call to the plot function in R

可紊 提交于 2019-12-21 21:12:02
问题 I would like to have a plot in both pdf and png formats: pdf("test.pdf") plot(sin, -pi, 2*pi) dev.off() png("test.png") plot(sin, -pi, 2*pi) dev.off() But, I am searching for a trick (preferably, not by loading a new package) in which plot function only be called once: #no plot in pdf! pdf("test1.pdf"); png("test1.png") plot(sin, -pi, 2*pi) dev.off(); dev.off() Any suggestion would be appreciated. 回答1: You can use dev.copy() for your purpose. For instance: pdf("test.pdf") a<-dev.cur() png(

PNGs in Delphi 2009 Imagelists and Images

半城伤御伤魂 提交于 2019-12-21 17:54:26
问题 D2009 introduces PNG support for Images and Imagelists. However... I have an imagelist containing png images with alpha. I want to place one of these on a form using a TImage. How do I do this and get the image nicely composited? As an example of the problem I'm facing the code below fails to work correctly, and produces the effect shown: ImageList.GetBitmap(index, Image1.Picture.Bitmap); (source: clip2net.com) To explain a bit more: Drop a Timage on a form, and at design time, load a PNG

PNGs in Delphi 2009 Imagelists and Images

南楼画角 提交于 2019-12-21 17:53:01
问题 D2009 introduces PNG support for Images and Imagelists. However... I have an imagelist containing png images with alpha. I want to place one of these on a form using a TImage. How do I do this and get the image nicely composited? As an example of the problem I'm facing the code below fails to work correctly, and produces the effect shown: ImageList.GetBitmap(index, Image1.Picture.Bitmap); (source: clip2net.com) To explain a bit more: Drop a Timage on a form, and at design time, load a PNG

Python PIL - All areas of PNG with opacity > 0 have their opacity set to 1

早过忘川 提交于 2019-12-21 17:49:32
问题 Imagine a red circle with a black dropshadow that fades away on top of a fully transparent background. When I open and resave the image with PIL the background remains fully transparent but the dropshadow becomes full black. The problem appears without even altering the image: image = Image.open('input.png') image = image.convert('RGBA') image.save('output.png') I want to keep the image looking exactly as the original so that I can crop or resize it. EDIT: Here's a PNG that demonstrates the

Png's in iOS - png's in bundle vs downloaded - png8 vs png24

喜你入骨 提交于 2019-12-21 16:48:19
问题 I'm writing an iOS application and have some questions about using png's and performance which I couldn't find any answers for. My app uses pngs from 2 sources, some are in the app bundle, and others are downloaded from the internet and stored locally. The ones in the app bundle I have my head around, I know xCode optimizes them for iOS when the app is compiled (Byte Swapping and Premultiplied Alpha). I have the following questions about png's downloaded from the internet. 1) Do you still get

12 款图片快速优化和压缩工具

和自甴很熟 提交于 2019-12-21 14:13:27
PS 很强大,但做为一个程序员,PS 太复杂了,太庞大了,我们经常需要的就是图片进行简单的处理即可。下面是 12 个小型的图片工具,可以让你快速的有针对性的进行图片处理。 1 Riot Riot 是最佳的图片优化工具之一,可用于 png、jpeg 格式图片,可通过对比方式查看优化后的效果。用户可修复压缩参数,运行速度很快。 Download 2 Image Optimizer Image optimizer 是一个使用非常频繁的在线图片处理工具,可对图片进行大小修改、压缩以及优化;尽管在线优化速度稍微慢些,但很多时候已经足够。 Download 3 Super Gif Super Gif 是一个小工具,可运行于 Windows 和 Mac 系统,主要用于 gif 图片的优化,可在无损的情况下对 gif 压缩达 20% 左右,最佳效果是 50%。 Download 4 PNGGauntlet – PNG compression Software PNGGuautlet 是一个 .NET 程序,用来优化 png 图片的大小。 Download 5 ImageOptim ImageOptim 可让用户压缩和优化图片,更小的存储空间,更快的加载速度,ImageOptim 是个开源软件,支持Mac系统 Download 6 Super Png Download 7 WebGraphics

Convert PNG to SVG using python

痞子三分冷 提交于 2019-12-21 14:06:41
问题 Is there way to convert a png file into SVG file using only pure python or a python module such as wand? To be more precise, I want to convert a png into a real vector graphics, I don't want to embed a bitmap inside the svg, I want to convert into graphics code. I know this is possible with Illustrator or Inkscape, but I need an automated process. Thank you ! 回答1: You will need to run an external program to do the image tracing. A popular program is potrace. It is what Inkscape uses to

SVG to PNG with multiple image layers using PHP

帅比萌擦擦* 提交于 2019-12-21 12:25:45
问题 I convert svg to png image with this code <?php exec('/usr/bin/rsvg-convert -w 1000 -h 1000 tshirt.svg -o tshirt.png'); ?> This works with a single svg image. Actually i have an svg image which contains multiple layers of images like: 1st layer -: this is the background T-shirt image which is transparent 2nd layer -: this is another T-shirt image which contains color 3rd layer -: this is the small sticker image which should be placed on the T-shirt My svg code is -: <?xml version="1.0"

OpenGL ES 2.0 PNG alpha channel

梦想与她 提交于 2019-12-21 12:06:09
问题 I am just learning to work with OpenGL ES 2.0 for Android. I have been trying to simply display a texture on the middle of the screen, which was easy enough, but I cannot seem to get the PNG alpha to work properly. The image will either show with a black background, or the entire image will be blended into the background color slightly, depending on the settings I use. The actual tutorials I have followed to get to this point never worked with transparency, so I have tried to work in code I