I am doing image upload and resizing using the gd2 image library.
The image EXIF data is rotating my vertical pictures on resize. Is there a way to stop the image from rotating? or strip the exif data in php?
Barring learning the JPEG format and figuring out how to remove EXIF bit by bit...
You can use the GD library.
http://www.php.net/manual/en/function.imagecreatefromjpeg.php and http://www.php.net/manual/en/function.imagejpeg.php should do it.
Related
This link shows how pdfs could be converted to images. Is there a way to zoom my pdfs before converting to images? In my project, i am converting pdfs to pngs and then using Python-tesseract library to extract text. I noticed that if I zoom pdfs and then save parts as pngs then OCR provides much better results. So is there a way to zoom pdfs before converting to pngs?
I think that raising the quality (resolution) of your image is a better solution than zooming into the pdf.
using pdf2image you can accomplish this quite easily:
install pdf2image: pip install pdf2image
then, in python, convert your pdf into a high quality image:
from pdf2image import convert_from_path
pages = convert_from_path('sample.pdf', 400) #400 is the Image quality in DPI (default 200)
pages[0].save("sample.png")
by playing around with the quality parameter you should get the result you desider
First I'll start with my assumptions about thumbnail:
Thumbnail is the same image reduced by size so it is smaller in size and faster to load
In Exif data there is referance to Thumbnail Image so it might be part of the jpg file
Now what I think is that theoretically I can "inject" to a jpg file another thumbnail so that in windows i will see a small picture and when I will open the file I will see other picture
And my question is in guidlines how do I do that?
Thanks!
Some JPEG file format support including a thumbnail as part of the image header. In the JFIF format, the thumbnail can be either an RGB bitmap or a nested JPEG stream.
You need a JPEG encoder that will insert a thumbnail into the JPEG header. It's that simple. ImageMagic will do it. Many other JPEG encoders will do it as well.
I would like to run cloud code on save to use the uploaded large image(about 5mb) to generate a thumbnail(managed this using Parse Image module) and a compressed and progressive image of about 150kb which has not been possible by scaling the image using Parse Image module to like 1024px wide.
Best solution I came round to is to download the image, use jpegtran to scale down the images then with the progressive flag to make the images progressive.
Once done upload the file back to parse.com
I am trying to convert svg image to eps using Imagemagick. I am able to convert the image using Imagemagick, but the image size is too high when compared to the original image size and the content is not displayed correctly compared to the svg.
I was just wondering this too. However, it appears that Imagemagick might not be the best tool to do this.
Imagemagick is a "raster image processor," but SVG and EPS are vector formats. So using Imagemagick will cause those images to lose information as it has to convert from a vector format, to a raster format, and then back to vector. This probably explains why the contents of your image aren't correctly displayed.
Maybe consider using Inkscape to do this conversion using the following
# Works as of Version 0.92.4
inkscape ing.svg \
-E out.eps \
--export-ignore-filters \
--export-ps-level=3
where the -E flag is short for --export-eps to export EPS files.
Source:
http://imagemagick.org/Usage/formats/#vector
https://stackoverflow.com/a/30539923/6873133
I am using TCPDF to create PDF files converted from HTML input using it's writeHTML() function. However, images within the PDF have poor quality, while the original images have a high quality (as expected). The images are in PNG format. I already tried to use SetJPEGQuality(100), but that had no effect.
What is causing this?
Try using this:
$pdf->setImageScale(1.53);
http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/4831671
When using HTML to generate your PDFs you need to manually calculate the images dimensions by dividing it's original width and height by 1.53 and set the result as attributes.
For example, an image with dimensions of 200x100 pixels will become:
<img src="image.jpg" width="131" height="65" />
This is a nasty workaround and doesn't completely remove the blur, but the result is much better than without any scaling.
Try To convert your Image to JPG or JPEG first. Until Now, I DOnt have a problem to convert image with TCPDF. I Think TCPDF is powerfull, because it can convert arabic language too. I HAve try convert arabic font with fpdf n it still fail
Little Up.
I'd same quality problem and I solved it...
When you save your picture, do it in 8bits instead of 24bits and you will see a "beautiful anti-aliasing".