png

Rotate a PNG then resave with Image Transparency

假如想象 提交于 2019-12-17 19:26:03
问题 I'm having some major issues getting PNG transparency on a PNG that is being rotated. $filename = 'bird_up.png'; $source = imagecreatefrompng($filename) or die('Error opening file '.$filename); imagealphablending($source, false); imagesavealpha($source, true); $rotation = imagerotate($source, $degrees, imageColorAllocateAlpha($source, 0, 0, 0, 127)); imagealphablending($source, false); imagesavealpha($source, true); header('Content-type: image/png'); imagepng($rotation); imagedestroy($source)

Convert bitmap to PNG in-memory in C++ (win32)

↘锁芯ラ 提交于 2019-12-17 16:17:08
问题 Can I convert a bitmap to PNG in memory (i.e. without writing to a file) using only the Platform SDK? (i.e. no libpng, etc.). I also want to be able to define a transparent color (not alpha channel) for this image. The GdiPlus solution seems to be limited to images of width divisible by 4 . Anything else fails during the call to Save(). Does anyone know the reason for this limitation and how/whether I can work around it? Update: Bounty I'm starting a bounty (I really want this to work). I

Which format for small website images? GIF or PNG? [closed]

大憨熊 提交于 2019-12-17 16:13:53
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . When doing small icons, header graphics and the like for websites, is it better to use GIFs or PNGs? Obviously if transparency effects

How do I convert a TIF to PNG in Java?

北慕城南 提交于 2019-12-17 16:13:40
问题 Under Java what is the best way to go about converting an TIF file to a PNG? Simplicity is preferable, but if the simplest way is to use a third party library then I would consider that solution. 回答1: First, install JAI. Then install JAI/ImageIO. Then do public static void main(final String[] args) throws Exception { final BufferedImage tif = ImageIO.read(new File("test.tif")); ImageIO.write(tif, "png", new File("test.png")); } 回答2: Use imageMagic java libraries like im4java, their

Image resources for iOS

丶灬走出姿态 提交于 2019-12-17 15:35:40
问题 I'm probably missing something obvious here, yet I've been unable to solve the following problem: I have a project with image resources for both normal and retina screens, like someimage.png and someimage@2x.png , which are stored in a separate bundle. When I build the project, Xcode automatically packs them into a single multipage tiff ( imageName.tiff ), I've checked it in finder - it is actually multipage tiff with both images. However, here comes a problem: I struggle to load appropriate

How do I read JPEG and PNG pixels in C++ on Linux?

試著忘記壹切 提交于 2019-12-17 15:34:46
问题 I'm doing some image processing, and I'd like to individually read each pixel value in a JPEG and PNG images. In my deployment scenario, it would be awkward for me to use a 3rd party library (as I have restricted access on the target computer), but I'm assuming that there's no standard C or C++ library for reading JPEG/PNG... So, if you know of a way of not using a library then great, if not then answers are still welcome! 回答1: There is no standard library in the C-standard to read the file

JS实现帧动画

假如想象 提交于 2019-12-17 13:00:54
JS实现帧动画的原理 如果有多张帧图片,用一个image标签去承载图片,然后定时改变image的src属性(不推荐,相当于请求了多张图片,会发送多个http请求) 把所有动画关键帧绘制在一张图片里,把图片作为元素的backgroud-image,定时改变元素的background-position属性(推荐,只有一个http请求) 因为项目的要求,轮播图的第一张需要用n张图片实现一款动画,我这里用到的是第一种方法。。 首先思考一下,要实现动画必定要用到定时器了,既然有n张图那么一要用到for循环了。下面我要说说我在for循环和定时器上踩过的坑。 下面是html: <img src="" class="part1_pic_01_1" id="Jdove"/> 下面是js: var storyboard = ["1_00000.png", "1_00001.png", "1_00002.png", "1_00003.png", "1_00004.png", "1_00005.png", "1_00006.png", "1_00007.png", "1_00008.png", "1_00009.png", "1_00010.png", "1_00011.png", "1_00012.png", "1_00013.png", "1_00014.png", "1_00015.png", "1

iOS UIImage storage formats, memory usage and encoding / decoding

不想你离开。 提交于 2019-12-17 10:35:11
问题 How does iOS store images that are loaded from compressed data (jpeg2000, png, jpg, etc.) Example: [UIImage imageWithData:pngData] Does it store the actual encoded bytes internally and decompress on demand, or is it decompressed into raw pixels permanently or some other format? 回答1: I created a test app on an iPad 2 that loaded 200 384x384 pixels jpeg2000 image files (117,964,800 bytes worth of raw pixels) using the following three methods: [UIImage imageNamed] , [UIImage

Convert UIImage to NSData and convert back to UIImage in Swift?

邮差的信 提交于 2019-12-17 10:15:23
问题 I'm trying to save a UIImage to NSData and then read the NSData back to a new UIImage in Swift. To convert the UIImage to NSData I'm using the following code: let imageData: NSData = UIImagePNGRepresentation(myImage) How do I convert imageData (i.e., NSData ) back to a new UIImage ? 回答1: UIImage(data:imageData,scale:1.0) presuming the image's scale is 1. In swift 4.2, use below code for get Data(). image.pngData() 回答2: Thanks. Helped me a lot. Converted to Swift 3 and worked To save: let data

Matplotlib Plots Lose Transparency When Saving as .ps/.eps

杀马特。学长 韩版系。学妹 提交于 2019-12-17 09:33:19
问题 I'm having an issue with attempting to save some plots with transparent ellipsoids on them if I attempt to save them with .ps/.eps extensions. Here's the plot saved as a .png: If I choose to save it as a .ps/.eps here is what it looks like: How I got around this, was to use ImageMagick to convert the original png to a ps. The only problem is that the image in png format is about 90k, and it becomes just under 4M after conversion. This is not good since I have a lot of these images, and it