Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I programatically add image to the layer? #82

Open
karolis-stulgys-allhuman opened this issue Feb 28, 2023 · 4 comments
Open

Can I programatically add image to the layer? #82

karolis-stulgys-allhuman opened this issue Feb 28, 2023 · 4 comments

Comments

@karolis-stulgys-allhuman
Copy link

karolis-stulgys-allhuman commented Feb 28, 2023

So instead of me going to photopea, uploading psd file, selecting layer, adding an image, resizing to fit the layer, exporting to png...
I would like to do this programatically in javascript (server side or client side). I want to write a function that accepts psd file, image file and options. It should output a .png file. Am I in the right place? Can I do this with "webtoon"? I've found libraries like "psd.js" but still not sure how can I achieve that. Can anyone give me an example? Your help is very much appreciated!

@jatinshrma
Copy link

karolis

were you able to do it then? because currently I am looking for the same thing and webtoon documentation does not provide anything about modifying the layer image.

@winderzhang
Copy link

me too

@pastelmind
Copy link
Collaborator

Hi, sorry about the late reply @karolis-stulgys-allhuman @jatinshrma @winderzhang

Unfortunately, modifying the contents of the PSD (e.g. adding or removing layers) is currently out of the scope of this library. Implementing such a feature would certainly benefit us and others, but updating the structure of a PSD file is an entirely different matter from parsing one. (For that matter, I believe PSD.js does not provide such capabilities, either.)

I suggest two options:

  1. ag-psd seems to support writing to PSD files, so I assume it supports modifying them, too.
  2. If your end goal is to produce a regular image (i.e. PNG) rather than a PSD file, you could extract individual layers from the PSD file (with @webtoon/psd) and combine them manually. You can either use the Canvas API (in browser) or one of the many image manipulation libraries for Node.js.

@ramca09
Copy link

ramca09 commented Jul 10, 2023

Hi, @pastelmind
I love @webtoon/psd.💕
I have a trouble in using this module(0.4.0). Please help me.... 🙏
Can I parse mask layer and apply it? Is it possible?
If yes, could you provide me the sample code or docs?
Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants