Adding Image in excel using pyexcelerate - python

I am using pyexcelerate library to generate an excel sheet in python. I need to add an image at the top using an image url but I could not find any solution for that library. Can anyone tell whether its possible to add image using pyexcelerate?

I'm afraid, this isn't possible. The library pyexcelerate is aiming to fast writing data. If you want add an image, use an different library, for example openpyxl: https://openpyxl.readthedocs.io/en/stable/usage.html?highlight=image#inserting-an-image

Related

"imagio.imsave" vs "imageio.core.util.Array.tofile"

I am expanding my limited Python knowledge by converting some MATLAB image analysis code to Python. I am following Image manipulation and processing using Numpy and Scipy. The code in Section 2.6.1 saves an image using both imageio.imsave and face.tofile, where type(face)=<class 'imageio.core.util.Array>'.
I am trying to understand why there are two ways to export an image. I tried web-searching tofile, but got numpy.ndarray.tofile. It's very sparse, and doesn't seem to be specific to images. I also looked for imageio.core.util.Array.tofile, but wasn't able to find anything.
Why are there two ways to export files? And why does imageio.core.util.Array.tofile seem to be un-findable online?
The difference is in what the two functions write in the file.
imageio.imsave() saves a conventional image, like a picture or photo, in JPEG/PNG format that can be viewed with an image viewer like GIMP, feh, eog, Photoshop or MSxPaint.
tofile() saves in a Numpy-compatible format that only Numpy (and a small number of other Python tools) use.

Add and Remove Watermark to PDF using Python

Is there a way to add a watermark containing some images (icons, data matrix codes, preferred in a vector format) and text to a PDF in a way that the original appearance of the PDF can be restored, whenever needed?
In other words, I want to implement the following:
- add a watermark to existing PDF
- remove this watermark whenever desired
The watermark is provided by me in whichever format it might be needed to achieve my goal.
I have found implementations written in Python like this solution using PyPDF2. But I have not found a way to remove the added watermark afterwards. Also I have found a solution to add and remove watermarks using iText, which unfortunatelly is not a Python library.

How to compress PNG image with S3TC/DXT algorithm in python?

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')

In atom editor using hydrogen for jupyter/python, how to extract/save an image?

Is there a straightforward way (one line code or even context menu) to save an image that is shown in a return bubble from the Hydrogen package in the Atom.io editor?
I actually managed to extract the base64 code for the png from the developer-pane inspecting the bubble, and this can be used to generate the image. However, that is very cumbersome and it's easier to use pyhton to save the image (see below).
Remark:
Of course, since python is used to generate the image, it is in principle possible to save the image by injecting python code, however, sometime I just want to save the picture generated without going back to the file that contains the code that generates it.
This is not currently possible due to an Atom limitation. See: https://github.com/nteract/hydrogen/issues/245

Using PDFTron in Python, remove all image elements from a PDF with given size characteristics

I'm trying to remove a large number of very small images from a series of PDF documents using the awesome looking PDFTron library for Python. Basically I want to create a new PDF by going over each element in an existing PDF file and copying the ones that meet a certain size criteria to the new PDF in the same position.
Can someone guide me to PDFTron documentation specifically for Python to help me accomplish this? Or provide a sample script that checks for image size? I think I can do the rest (emphasis on think). The documentation available on the PDFTron website is not specifically for Python, hard to look up what I need...
You can see from the ElementEdit sample how to remove all images from a document:
http://www.pdftron.com/pdfnet/samplecode.html#ElementEdit
Or provide a sample script that checks for image size?
Could you clarify what you mean by "image size"? If you mean the image's dimensions as displayed in the PDF page, you can check that using Element.GetBBox. If you mean the dimensions of the original image, you could check that using Element.GetImageWidth and Element.GetImageHeight (see http://www.pdftron.com/pdfnet/samplecode.html#ImageExtract). Also, Image.GetImageDataSize gives you the size of the image data in bytes.

Categories

Resources