Skip to main content
wayne_carey
Known Participant
July 7, 2022
Answered

JPEG with outline path to transparent PNG files conversion

  • July 7, 2022
  • 3 replies
  • 5296 views

Hey Everyone!

 

I’ve been handed what could be a HUGE project if I can’t find a solution to make this easier. I’ve got hundreds, if not, thousands of JPEG files that have been outlined with a path, and our web guys are moving to a new B2B platform that requires transparent PNG files rather than JPEG files for our product images. Does anyone have a quick easy solution, maybe an app, that can convert a folder of pathed outlined JPEG files into transparent PNG files? I can painfully do this one file at a time in Photoshop but it will take WAY too long to do this. 

 

Before we go any further, I’m on an Intel-based iMac running macOS 12.4 Monterey.

 

I’ve scoured the web for a Mac-based app for the conversion and so far, all I’ve downloaded will not save a transparent PNG from a pathed outlined JPEG. I guess I could write an Action and use the Batch tool to do this but that’s far from perfect in my experience, especially what I need to do here. Any thoughts?

This topic has been closed for replies.
Correct answer willcampbell7

Thanks again, William.  Thinking about it, I think it might be a great option for disabling the letter case.  That way I could still denote the web version over the full res version in the file names and others could have the choice if they should want it.


I made a few more tweaks. I realized the code I used for saving JPG is better suited for print work (I come from the print biz) and uses baseline. I updated the script to use progressive, 3 scans. Better for web images. Also @wayne_carey how about marking my answer as the solution? It is, I hope. It helps my reputation here <smile>

https://www.marspremedia.com/software/photoshop/batch-web-images

 

3 replies

Earth Oliver
Legend
July 15, 2022

I've been using Image Processor Pro to do exactly this for the past 15 years. Before dismissing the great advice you received here, you should have at least tried to use the tool. 

willcampbell7
Legend
July 15, 2022

This sounds like a good idea for a new script so I took a stab at it the morning. I've taken components from my other scripts and combined the parts into a solution specific to this need. I call it "Batch Web Images." It's fresh out the oven, conceived only hours ago, so bear with me if I missed something and it throws an error because of something I didn't anticipate. Gotta start somewhere, and this is it. I'll watch responses and fix anything that comes up. Also I am thinking maybe add the option to crop close to the subject, perhaps enter a small percentage of subject size for margin all around. All feedback is welcome. Download at this link:
http://www.marspremedia.com/software/photoshop/batch-web-images

EDIT: oh and I forgot to mention, please mark as correct answer if it works out. Thanks!

EDIT2: here's an image...

 

William Campbell
Stephen Marsh
Community Expert
Community Expert
July 16, 2022

@willcampbell7 wrote:

I'll watch responses and fix anything that comes up. Also I am thinking maybe add the option to crop close to the subject, perhaps enter a small percentage of subject size for margin all around. All feedback is welcome.


 

Thank you for sharing William! I have given it a test and these were my initial findings:

 

* I like the fit image option

 

* As you suggest, adding an option to pad out the image with a margin/canvas extension would be nice. Would this only be transparency, or content-aware fill, solid colour etc?

 

* Although not obviously stated, if selecting the parent folder and including sub-folders as input, then selecting the same parent top-level folder as output – the sub-directory structure is maintained, which is great!  (perhaps worth noting in a read-me doc)

 

* Although not obviously stated it is the first path being used (perhaps worth noting in a read-me doc)

 

* Perhaps adding an option to use the first alpha channel in addition to the first path or select subject

 

* It would be nice to have an option to save and reuse the previous settings, folder paths etc. when re-running the script.

 

* If the path option is selected, and the input is PNG or does not contain a path, select subject is used by default.  (perhaps worth noting in a read-me doc)

 

* On Mac Photoshop 2021 version – Progress Bar issues:

 

1) Progress bar remains after script run, requires manual close

2) If re-opening an input image directly after running the script, the progress bar reappears, even though the script has finished processing all images. Escape or mouse close does not help, it keeps re-appearing if one navigates away and back to Photoshop.

 

I personally don't consider the display of the progress bar to be that critical, it is more of a PITA to deal with these issues than the benefit it is intended to provide.

willcampbell7
Legend
July 20, 2022

Stephen, I looked into the progress issue more. Other scripts of mine have this trouble, too, and your comments prompted me to make a solution. The trouble happens when Photoshop loses focus. And up to now, the progress window is closed before the final "Done" alert. So if it the call to close progress happens while Photoshop doesn't have focus, it doesn't close. Then once Photoshop has focus again, it's stuck. So I added to this script (and now will to others) a final call to progress.close() as the last line of execution before the script ends. That solves the problem. The script is updated, get the latest at the same link. Thanks again for the feedback. Got me thinking and led to a solution.

 

William Campbell
Stephen Marsh
Community Expert
Community Expert
July 7, 2022

Can you upload a few example images? If you can do this via a batch action a script would do the same.

wayne_carey
Known Participant
July 7, 2022

I thought about that and tried it but the action can't save to the other folders you're working in (meaning the Action can ONLY save to the folder you used when creating the Action to save the file as a PNG) and batching it doesn't save to different file formats, just appending to the existing file name.  So that makes you think of using the Image Processor.  Well, it doesn't save to PNG.  I've been complaining to Adobe about this for many years now.  I've added a file showing an example of the files I have to work with.  It is a low-resolution with outlined path to keep this simple.  Years ago, I had a stand-alone app for the Mac that did exactly what I need but it's no longer in the app store and I can't find anything in any search engine for an app to do this.

Stephen Marsh
Community Expert
Community Expert
July 7, 2022