Help: v1/files/images - How to get an image in Python for manipulation?

Started by rreyer, December 04, 2024, 11:07:55 AM

Previous topic - Next topic

rreyer

So far I could access information about selected files/images, their metadata and categories.
It works great! 👍👍👍

Now I'd like to get these selected files as actual images (thumbnails, cache images).
I need to process them (resize, combine, add text) and save them as JPG.

How do I get an image from v1/files?

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

rreyer

Many thanks for this valuable advice.
If only I had scrolled down a little further, I would certainly have noticed it.
::)

Ok, then I'll clarify my question: WHAT do I get when I call up an image?
Before you reply that it would be an ,,image", I mean the data format, the type in Python.

Mario

Tip: When you call endpoints in your browser (or via tools like PostMan) you can see the response from IMWS.

The endpoint returns the pixels of the image as a binary data stream with a mime type depending on the format used (JPG or PNG or the extension of the original file when the original file is requested).

v1/files/image/base64

returns a Base64-encoded image, but that's more for icons and small images.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

The IMatchLib.js (or .ts) source library included in IMatch has a method ImageUrl() that can be used to fetch an image in a specific size and use it e.g. for a src= Attribute in HTML ot fetch it with Curl or Python or whatever. See source code for details. auth-token can be empty for local use.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook