So, i'm trying to optimize my images from Cloud Store because of using their thumbnails on website, images are tranforming in GAE. And one of the possibilities is converting JPEG images with progressive mode.
Is this possible in google images api to convert simple JPEG image to progressive mode? Or are there another library that i can use in GAE for this task?
The only solution that i can think now is upload images already in progressive mode using jpegtran lib.
Related
I am completely new to working with point cloud data. Right now I have a ".ply" file and its corresponding ".bmp" file. Both of them were generated from a TOF camera.
I am trying to get a ".jpg" file by superimposing the depth data on the BMP file, but i am ffailing miserably.
I have tried using the open3d library for this purpose. But it does not work on google colab. Therefore I am looking for a solution in the python-pcl library (or any other library)
how can I achieve this?
I'm trying to process some images and obtain numerical output. The skimage library only works with jpg format images. I only have tiff images on hand. Most converting functions work by loading a tiff image and saving it in jpg format. I do agree that the easiest way is
PIL.Image.open('pic.tiff').save('pic.jpg','jpeg')
I'm, on the other hand, trying to abstain from using hard drive for several reasons, but mainly due to the complexity file handling on heroku. Hence the question.
I try to find way for compressing images(PNG as an example) with any S3TC/DXT algorithm using python libraries.
As I can see in Pillow(PIL) library DDS format in Read-only formats section. Therefore Pillow can't be used for this purpose.
Searching in google didn't give positive results.
Question:
Is it possible to do with python?
Could someone please provide link to libraries with such functional?(which is checked on practice)
DDS format is not mandatory for my case. I need only compressed file.
PS:
It's required for creating textures for future use.
Library should support different algorithms of compression.
You could use Python Wand. Here I create a pseudo image with a magenta-yellow gradient and save as DDS:
from wand.image import Image
with Image(width=200, height=80, pseudo='gradient:magenta-yellow') as img:
img.save(filename='result.dds')
Or, if you want to load a PNG file and save as DDS:
with Image(filename='input.png') as img:
img.save(filename='result.dds')
Is there a way to count number of images(JPEG,PNG,JPG) in a pdf document through python?
Using pdfimages from poppler-utils
You might want to take a look at pdfimages from the poppler-utils package.
I have taken the sample pdf from - Sample PDF
On running the following command, images present in the pdf are extracted -
pdfimages /home/tata/Desktop/4555c-5055cBrochure.pdf image
Some of the images extracted from this brochure are -
Extracted Image1
Extracted Image 2
So, you can use python's subprocess module to execute this command, and then extract all the images.
Note: There are some drawbacks to this method. It generates images in ppm format, not jpg. Also, some additional images might be extracted, which might actually not be images in the pdf.
Using pdfminer
If you want to do this using pdfminer, take a look at this blog post -
Extracting Text & Images from PDF Files
Pdfminer allows you to traverse through the layout of a particular pdf page. The following image shows the layout objects as well as the tree structure generated by pdfminer -
Layout Objects and Tree Structure
Image Source - Pdfminer Docs
Thus, extracting LTFigure objects can help you extract / count images in the pdf document.
Note: Please note that both of these methods might not be accurate, and their accuracy is highly dependent on the type of pdf document you are dealing with.
I don't think this can be directly done. Although I have done something similar using the following approach
Using ghostscript to convert pdf to page images.
On each page use computer vision (OpenCV) to extract the area of interest(in your case images).
I am trying to pass an image from one microservice to another microservice as a parameter where the image would be processed.
What is the best way to send this image across the services, image is in jpg format .
What I have tried is :
import binascii
f1 = open("imageName.jpg","rb")
sendToServiceTwo(binascii.hexlify(f1.read()))
The size of the image is around 28kb but in the converted hexadecimal format the size is increased to 48kb . I don't want to apply any compression while transferring the data.