OT: creating PSD file from images via code from Rhino

Hi All,

Slightly OT, but I am trying to see if anyone has any experience or advice of how to create a PSD (Photoshop) layered file from a set of images on HD (JPGs, PNGs). I am looking for a way to have it controlled from Rhino (Python?), and not using any outside software like Gimp or Photoshop itself.

thank you,

–jarek

Hi All,

I have found something like this - my knowledge of Python currently is very limited - I would appreciate any advice if that could potentially be used with Rhino version of Python (IronPython?) or that is Python-only?
https://pytoshop.readthedocs.io/en/latest/

Thanks,

Jarek

Hi @Jarek,

This library is for CPython, not IronPython.

– Dale

That’s what I suspected (not usable with Rhino Python). Thanks for clarifying.

–jarek

@Jarek I don’t know if this can help you :

hi jmv,

thanks for the link, it actually looks very interesting (I can’t find a download think there, though).

But is not what I need for my current task. I need to be able to create PSD files from single images with no need for Photoshop to be installed/present. With Photoshop running, I can control it via script, no problem…

thanks again,

–jarek

the links are on second page.

Ok you can use Magick.NET and GhostScript

import clr
import sys

sys.path.append(r"E:\_Test\Magick.NET")
clr.AddReference ("Magick.NET-Q16-AnyCPU.dll") 
import ImageMagick  

collection = ImageMagick.MagickImageCollection()
collection.Add (r"E:\_Test\1.jpg")
collection.Add (r"E:\_Test\2.jpg")

collection.Write(r"E:\_Test\1-2.pdf")

This build a PDF with 2 pages.
read the documentation here : https://github.com/dlemstra/Magick.NET/tree/master/Documentation

jmv.

2 Likes

That looks promising, thanks! I will explore that option.
Looks like GhostScript is only needed if you write EPS/PDF/PS, so for PSD hopefully just the Magick.NET would do.

Thanks again for the suggestion and the sample code!

Jarek

hi jmv,

I tested some more and it works OK for a simple PSD writer (just to merge bunch of files into one layered PSD).
Not much more can be done in terms of controlling details of the file and layers, but this is a very good start.

Thanks again for pointing me the right direction.

Best,

Jarek