png

Use PHP to convert JPEGs to transparent PNG

本小妞迷上赌 提交于 2019-12-18 12:06:43
问题 I have a lot of JPEG images that I want to convert to PNG images using PHP. The JPEGs are going to be uploaded by clients so I can't trust them to make sure they are in the right format. I also want to make their white backgrounds transparent. Does PHP have any functions I can use to achieve this? 回答1: After a few days of trying different solutions and doing some more research, this is what I found worked for me. $image = imagecreatefromjpeg( 'image.jpg' ); imagealphablending($image, true);

How to change the image format from JPEG to PNG in android?

你离开我真会死。 提交于 2019-12-18 12:01:46
问题 I am opening the default android device camera by passing an intent. So when an image is captured, by default, camera stores it in JPEG format. But I don't want to store them in lossy format. I want picture quality to be high. So how can i store it in PNG format?... here goes my code to open camera : Date dt = new Date(); int date=dt.getDate(); int hours = dt.getHours(); int minutes = dt.getMinutes(); int seconds = dt.getSeconds(); String curTime = date+"_"+hours + "_"+minutes + "_"+ seconds;

How to maintain PNG alpha transparency when using “-ms-filter” property

天涯浪子 提交于 2019-12-18 11:43:11
问题 I have the following HTML: <a><img src="myfile.png" /> Some text</a> And this css: a:hover { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)"; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=75); opacity: .75; } The problem with this occurs in both IE 8 and IE 7. When the PNG image is subject to the -ms-filter or filter , its alpha transparency is ruined. Try it out and you will see. It is a bug in both IE 8 and IE 7. Can I remove the "-ms-opacity" and "filter"

How to crop a section of a PDF file to PNG using Ghostscript

风流意气都作罢 提交于 2019-12-18 11:36:27
问题 I need to crop a certain section in my PDF file to PNG (this will be automated using Ghostscript with PHP). This is what i do now which basically turns the first page of a PDF to PNG: gs -q -dNOPAUSE -dBATCH \ -sDEVICE=pngalpha -dEPSCrop \ -sOutputFile=output.png input.pdf Specifically, i'm trying to crop this top left card to a PNG. I'm also open for more suggestions on how to accomplish this. 回答1: First, determine the bounding box of your first PDF page: gs \ -q \ -dBATCH \ -dNOPAUSE \

Ghostscript color detection

强颜欢笑 提交于 2019-12-18 10:46:16
问题 I seem to be unable to find whether Ghostscript is able to simply detect whether job is color or grayscale. I use Ghostscript for conversion of print jobs to PNG, but I also need to have information about color of the job, so I don't have to search it pixel by pixel again. 回答1: A (relatively new) Ghostscript device called inkcov (you need Ghostscript v9.05 or newer) can reliably detect whether a PDF page uses color or not. It displays the ink coverage for the CMYK inks, separately for each

Why am I getting the error: “Not a JPEG file: starts with 0x89 0x50” [closed]

橙三吉。 提交于 2019-12-18 10:10:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . Why am I getting the message "Not a JPEG file: starts with 0x89 0x50" when I try to open my jpg file? 回答1: The file is actually a PNG with the wrong file extension. "0x89 0x50" is how a PNG file starts. 回答2: Your file is not a JPEG file, it's just been renamed from a PNG to a JPEG somewhere along the way. Some

MIME type warning in chrome for png images

依然范特西╮ 提交于 2019-12-18 10:09:35
问题 Just ran my site in chrome and suprisingly it comes up with this warning for each of my .png images: Resource interpreted as image but transferred with MIME type application/octet-stream. Anyone seen this before? Regards 回答1: I encountered this while running an ASP.NET WebForms app using the ASP.NET Development Server. I suspect something similar will happen if you use IIS Express as your server as well (VS 2010 SP1). I 'resolved' my problem locally by editing the project settings (under Web)

PIL: Thumbnail and end up with a square image

邮差的信 提交于 2019-12-18 10:01:39
问题 Calling image = Image.open(data) image.thumbnail((36,36), Image.NEAREST) will maintain the aspect ratio. But I need to end up displaying the image like this: <img src="/media/image.png" style="height:36px; width:36px" /> Can I have a letterbox style with either transparent or white around the image? 回答1: Paste the image into a transparent image with the right size as a background from PIL import Image size = (36, 36) image = Image.open(data) image.thumbnail(size, Image.ANTIALIAS) background =

Semi Transparent PNG as Splash Screen

放肆的年华 提交于 2019-12-18 09:08:23
问题 I'm trying to make a Splash Screen 4 an Win application. my setup: form border style is set to none. start position is screen center. background image of the form is set to a PNG file, with rounded edges and a "build in" drop shadow. In code I've set: this.SetStyle( ControlStyles.AllPaintingInWmPaint, true); this.SetStyle( ControlStyles.UserPaint, true); this.SetStyle( ControlStyles.DoubleBuffer, true); this.SetStyle( ControlStyles.SupportsTransparentBackColor, true); this.AllowTransparency =

Has iOS 7 changed PNG compatibility/handling?

随声附和 提交于 2019-12-18 08:39:13
问题 I've got an app that uses a UIWebView , and everything was (and still is) working perfectly on iOS 6. On iOS 7, though, it is sometimes kicking back an error ImageIO: PNG not a PNG file when I try to load certain PNG files, (for example this one). Now, obviously the PNG files aren't corrupted because they work on iOS 6 and they sometimes work even on iOS 7, but then sometimes they kick back that error. I can't find any common cause that determines when the error happens, and I'm not doing