jpeg

PHP exif_read_data Illegal IFD size

廉价感情. 提交于 2019-12-21 06:59:58
问题 I'm working on an application where I fix orientation (if it is present) of jpeg files downloaded from an AWS bucket. Here you can verify that this image has exif Rotation section. I download the image with file_put_contents('/local/path/to/file', file_get_contents('/path/to/url/image')); And after I try to fix orientation through the Gregwar Image library. Image::open($path)->fixOrientation()->save($dest, $type, $quality); I tried with several images and I always receive the message Warning:

From latex math formula to big jpeg file

大城市里の小女人 提交于 2019-12-21 06:08:07
问题 I am wondering whether anyone knows a easy way to convert a latex math formula to a big jpeg file? Here is the latex math formula: \[ \lim_{u\rightarrow 0_+} \int_0^u \ud s \int_{-\infty}^\infty \frac{f(u-s,x-y)}{\sqrt{2\pi s}} \exp\left\{-\frac{y^2}{2s}\right\} \ud y \] Thanks! 回答1: This isn’t really programming related at all, but here’s a way to do this: Use the class standalone in your LaTeX source file. This will produce a document that is exactly as large as needed, and no larger.

When saving bitmap to disk, solid paths show artifacts

穿精又带淫゛_ 提交于 2019-12-21 05:02:41
问题 [Edit: I've made a minimal project to try to narrow down what's going on. The code at the bottom still generates the same artifacts when saved] I have an app that draws simple 2D geometry using Paths. The shapes are all solid colors, sometimes with alpha < 255, and may be decorated with lines. In the View that draws the geometry, there has never been an issue with how things get drawn. However, when I use the same code to draw to a Bitmap, and then save it as either a JPEG (with 100 quality)

How to create a progressive JPEG image on Android

扶醉桌前 提交于 2019-12-21 04:14:33
问题 I need to send images over a very low-bandwidth connection from an android phone (down to 10kByte/s) and would like to send them in progressive (interlaced) mode so that the user at the other end starts seeing the image already during the lengthy transfer. Right now, I am creating the image with the regular photo app: Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); But this creates non-progressive photos and I have not been able to discover how to convince it to do

Why Java ImageIO flattens JPEG colors

冷暖自知 提交于 2019-12-21 04:02:14
问题 When I read certain JPG files, colors are flattened. Here is a simple example that reads a jpg and just writes the same image to another file. import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; public class JPegReadTest { public static void main(String[] args) { if (args.length == 2) { try { BufferedImage src = ImageIO.read(new File(args[0])); ImageIO.write(src, "jpg", new File(args[1])); } catch (Exception e) { e.printStackTrace(); } } else { System.err

How can I convert a JPEG image to a PNG one with transparent background?

我只是一个虾纸丫 提交于 2019-12-21 02:45:19
问题 I have a JPEG format image, with a white background and a black circle. How can I transform this image to a PNG format that the white background will be transparent and the black remains there? I'm a programmer too, and if there are some ideas in C# code I will be very happy. Also I'm looking for a converter, tool, program anything. Thank you. Jeff 回答1: Here is working, but slow solution. You can speed it up by using Bitmap.LockBits(). using (Image img = Image.FromFile(filename)) using

Can I fix photos with corrupt jpeg data?

社会主义新天地 提交于 2019-12-20 20:00:10
问题 My phone (android, fwiw) takes pictures that are corrupted. I'm not sure why or how it is doing this, but it seems to prevent me from uploading the photos to some services. If I move the photos to my computer and open them in GIMP I see a warning message: Corrupt JPEG data: 1130 extraneous bytes before marker 0xd9 The error doesn't prevent me from viewing or editing the photos, but I'm wondering if there's some way to set up a batch process that would fix this problem? 回答1: It's hard to tell

In OpenCV (Python), why am I getting 3 channel images from a grayscale image?

三世轮回 提交于 2019-12-20 10:18:45
问题 I am using Python (2.7) and bindings for OpenCV 2.4.6 on Ubuntu 12.04 I load an image image = cv2.imread('image.jpg') I then check the shape of the image array print image.shape I get (480, 640, 3), which I expect for a 640x480 colour image. I then convert the image to grayscale and check the shape again. gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) print gray_image.shape I get (480, 640, 1), which I expect for a 640x480 grayscale image. I then save the image: cv2.imwrite('gray.jpg',

A route to serve static assets (like .jpgs, etc?)

我们两清 提交于 2019-12-20 09:56:45
问题 I've worked my way through a number of interesting routing problems - turning a request URL into a hash, etc., but just out of curiosity, is there a way to tell the routing system that you want anything that comes under a certain url subpath to be served literally - without going through a controller? For instance, if I have /home/me/public_html/rails_proj/images/foo.jpg, and .../rails_proj/images/other/bar.jpg, can I insert a route that says "anything under images should just be served as an

ImageMagick PDF to JPGs sometimes results in black background

泄露秘密 提交于 2019-12-20 09:48:26
问题 I have the following: ghostscript-fonts-5.50-24 ImageMagick-6.7.2-1 ghostscript-9.02-1 Which I use to create a series of JPGs for each page using: convert -density 175 -colorspace sRGB test.pdf -resize 50% -quality 95 test.jpg When I run this on my windows machine all appears to work ok, but on our linux server we get the black background problem. The resulting JPGs have a black background rendering the image un-readable, what am I missing or is there something I should be doing to correct