• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Combine two set of images in two folders transparent PNG over background - batch export

Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

I am 100% sure this is already explained but I do not know what I should type in a search to get to the result.

 

I have 500 PNG transparent images in one folder named Image (1) Image (2) Image (3)... and 500 background JPG images in another folder named Background (1) Background (2). All images are the same dimensions. 

I want Photoshop to take:

Image (1) and put it over Background (1) and export

Image (2) and put it over Background (2) and export

Image (3) and put it over Background (3) and export... and so on the entire folder.

 

I have to do this a lot so my plan was to get a folder of PNG and JPG and duplicate that, rename it (and for this to be as easy as possible I went for images in folder one with renaming everything in to "Image" which gives me results Image (1) Image (2)... and the other folder Background which gives me results background (1) Background (2)... if I do this then my Photoshop action will always work since the names of the photos will always be that, I think?

 

How do I achieve this?

 

The PNG files should be created from an Excel file.

 

I have an Excel file with text in 2 columns.

One is the TERM name and the other column is the definition.

 

I am trying to figure out how to set Photoshop to batch export transparent PNG using the text from the EXCEL (see image).

 

And then combine them with the background image. 

 

I do not want to do this in one action because I will combine transparent PNGs with different backgrounds. 

 

Any help?

 

Thank you.

 

 

 

 

 

 

 

TOPICS
Actions and scripting

Views

6.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 05, 2021 Apr 05, 2021

I have never used Data Driven Graphics.  What you Posted looks like a contact sheet of your Data Driven Graphics output Jpeg Files.  Can Data Driven Graphics output Layered PSD files?   If it can you should be able to align the bottom text paragraph text layers the way you want them aligned.  You may be able to automate that process with Photoshop script you write. It depends on Data Driven Graphics being able to  save layered PSD files and then on how well you can script Photoshop.

 

If the Par

...

Votes

Translate

Translate
Adobe
LEGEND ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

Thank you for responding. I see on the link code for opening separate images as layers. I do not want to open them. 

 

I just want to merge them. Merge transparent PNG over background JPG and saved as JPG. And for Photoshop to do that for the entire folder, all images in the folder.

 

This is what I have in two folders in the attachment. 

 

I want Photoshop to merge them all individually 1 with 1 2 with 2...

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

Yes, that was something similar I made last days I had still in memory you can use somehow.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

That code is for random images taken from folders, I need it to go by order 1 to 1 2 to 2... and for opening, if I get 500 images opening at once in Photoshop it will crash...

 

There is no way to merge PNG and JPG from two folders with Photoshop?

 

And regarding my second question, importing text from columns in Excel, should I open another topic exclusively for that to get help on that?

I want Photoshop to take text from column 1 and put it on top, column 2 text in the middle and then export that as transparent PNG. (Next would be to also merge it with the background. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

I shared just some coding for later use. Regarding other topic for Excel part, this one is enough.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

I solved the Excel part and now the only issue regarding that is text alignment. 

 

I need text to be aligned in the bottom left so longer sentences do not get cropped out. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

You may be able to this wit a mockup template and a script whene you rename the png and background jpg like you stated you did. so image and background sort in the same order and match up.  An action cam olet doe the smage bymvet of filese the bate  would always net to contain the same number of images the names recorded in the action steps.  A script cans process folders of images in file sort order.  The two fouler just need to have the same number of images,  The Batch mockup scripts in my toolkit can populate such a mockup.  Or you may be able to use a Photoshop Data driven template with your  excel CSV  file.

 

There may be a problem using PNG file that has transparent background where  boarder area are completely transparent.  Photoshop features like Place and Copy/Paste I believe will trim you png images transparent boarders. Png image layer bounds will be smaller than canvas size and may have a different Aspect Ratio then the background layer. If you need the transparent border for the PNG and JPG  to align correctly.  You mare need to edit your PNG First.   An action can be batch to add two 1% gray pixels to the png images one in the top left corner the other in the bottom right corner to eliminate Fully transparent boarders.  No one would see the pixels with their eyes.

image.png

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

OK. Let's see do I understand you correctly.

 

To separate two of my questions I will now talk about merging PNG and JPG.

 

You are saying that when I create PNG files I should create PNG files by setting background (layer) with 1080×1080 dimensions with 1% grey dots in corners. 

 

Then I merge them (somehow) with a background that is JPG file 1080×1080 and then PNG and JPG will merge as is.

 

And merging of PNG and JPG as batch (yes both folders will have a same number of images) is possible in Photoshop, I just have to figure out how. 

 

I do not use scripts, never had and I do not know how.

 

Second question Creating PNG from Excel

 

I was thinking it is possible in Photoshop to set TEXT 1, TEXT 2 and TEXT 3 on Artboard, set once again background layer with 1% grey in corners, set the font and styling and then ask Photoshop to take text from EXCEL CSV .text exported column 1 and put it in place of 1, column 2 on 2 and column 3 on 3 and export as PNG files. 

So no merging, just export as PNG with different text. 

 

I will keep the names of the columns always the same, just change text data. 

 

Is this possible?

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

I solved the Excel part I think.

 

Now I am facing a problem with the text.  is it still true that you can not align text in paragraph vertically in Photoshop?

 

Is there any trick to fix that?

 

I want to have all the text on the bottom of the image and as it is now it chops off some text when the text is longer. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

If I understand you correctly...Look up variables and data sets, I believe that will work for you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

Yes, I solved that.

 

Now the issue is text aligned on the bottom right in the paragraph text so it doesn't get chopped off.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

I have never created a Data Driven Graphics Template so I do not know how well Photoshop feature supports text layers.  I believe that you will need to create the text layer in the Template so that  the longest text string in the  excel file will fit within the documents canvas. I do not know what kind if any alignment options Data driven graphocs's text layer support may have. I saw Image alignment options in adobe tutorial. I did not see any for text. You may need to limit text  small difference in string length to get the alignment you want. Have text be about the same size as other text replacements. 

 

I don't use text much so I have never search for scripts that deal with text layers to edit or align.  I know Script can align layers to canvas location. I have done that often in scripts.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

The biggest problem is that Photoshop doesn't have vertical alignment in text paragraphs. 

 

if that was available I could create a paragraph rectangle that covers entire image, then do the data set batch export with an Excel text file and all the text will be positioned perfectly and fit to the image perfectly no matter how much text it has, one sentence would be on the bottom and text with more sentences would cover lower half of image or even more, but still fit perfectly on the image. I would just have to make sure that the data  with longest text fits and font size is appropriate to that one, rest would just match. 

 

2021 and Photoshop still doesn't have vertical alignment?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

The text tool does not have such an option but Photoshop layer support does.  You can select a canvas pixel location and align layers to that pixel 9 different ways.  So you can select a pixel near a document bottom right corner then align the bottom right corner of a text layer to that pixel.  It not hard to align layers.

 

Look at this script "PlaceLogo.jsx"

 

 

 

/* ==========================================================
// 2021  John J. McAssey (JJMack) 
// ======================================================= */
// This script is supplied as is. It is provided as freeware. 
// The author accepts no liability for any problems arising from its use.
/*
<javascriptresource>
<about>$$$/JavaScripts/PlaceLogo/About=JJMack's PlaceLogo ^r^rCopyright 2021 Mouseprints.net^r^rPhotoshop Script^rCustomize using first four var</about>
<category>JJMack's Script</category>
<enableinfo>true</enableinfo>
</javascriptresource>
*/
#target photoshop;  
app.bringToFront();  
var logoFile = "~/Desktop/JJMack.png";				// Logo Image file should be large for resize down works better than up. Vector files can be any size.
var LogoSize = 10;											// percent of document height to resize Logo to
var LogoMargin = 1;                                         // percent of Document height the Logo should have as a margin
var LogoLocation = 9;										// Like a tick tack toe board 1 through 9.  1=Top Left 9=Bottom Right
var LogoRotation = -20;										// Center Logo Location 5 can be Rotated -90 through +90 degrees  + degree Clockwise - CounterClockwise

app.displayDialogs = DialogModes.NO;				// Dialog off 
var strtRulerUnits = app.preferences.rulerUnits;	// Save Users ruler units 
var strtTypeUnits = app.preferences.typeUnits;		// Save Users Type units 
app.preferences.rulerUnits = Units.PIXELS;			// work with pixels 
app.preferences.typeUnits = TypeUnits.PIXELS;		// work with pixels 
//placeLogo(logoFile, LogoSize, LogoMargin, LogoLocation, LogoRotation); // Place Logo into the location 5 would be Document's center
if (documents.length) app.activeDocument.suspendHistory('placeLogo','placeLogo(logoFile,LogoSize,LogoMargin, LogoLocation, LogoRotation)' );
app.preferences.rulerUnits = strtRulerUnits;		// Restore user ruler units  
app.preferences.typeUnits = strtTypeUnits;			// Restore user type units    
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function placeLogo(Image,Size,Margin,position,angle){  
	if(!documents.length) return;  							// if no document return
	var fileObj = new File(Image);	 		               	// the passed file
	if(!fileObj.exists){  									// If file does not exits tell user 
		alert(fileObj.name  + " does not exist!"); 			// Alert User 
		return;  											// return
	}  
	try{  
		var doc = app.activeDocument;						// set Doc object to active document
		var layers = app.activeDocument.layers;				// get layers
		app.activeDocument.activeLayer = layers[0];			// Target Top Layer
		placeFile(fileObj); 								// Place in file the Logo File
		activeDocument.activeLayer.resize(100 ,100,AnchorPosition.MIDDLECENTER); // Insure Place did not scale layer  
		var SB = activeDocument.activeLayer.bounds; 		// get layers bounds 
		var layerHeight = SB[3] - SB[1];					// get layers height  
		var resizePercent = (100/layerHeight)*(Size/100*doc.height.value); // Percent to resize by 
		activeDocument.activeLayer.resize(resizePercent ,resizePercent,AnchorPosition.MIDDLECENTER);  // Resize width and height by percentage 
		marginSize = Margin/100*doc.height.value;			// Margin size
		var selectedRegion = Array(Array(0+marginSize,0+marginSize), Array(doc.width-marginSize,0+marginSize), Array(doc.width-marginSize,doc.height-marginSize), Array(0+marginSize,doc.height-marginSize));
		activeDocument.selection.select(selectedRegion);    // Select  document area for the logo Positioning
		switch (position){									// Align resized logo smart object layer into position
			case 1 : align('AdLf'); align('AdTp'); break;
			case 2 : align('AdCH'); align('AdTp'); break;
			case 3 : align('AdRg'); align('AdTp'); break;
			case 4 : align('AdLf'); align('AdCV'); break;
			case 5 : align('AdCH'); align('AdCV'); activeDocument.selection.deselect(); activeDocument.activeLayer.rotate(angle); break;
			case 6 : align('AdRg'); align('AdCV'); break;
			case 7 : align('AdLf'); align('AdBt'); break;
			case 8 : align('AdCH'); align('AdBt'); break;
			case 9 : align('AdRg'); align('AdBt'); break;
			default : break;
		}
		app.activeDocument.selection.deselect();			// deselect
	}
	catch(e) { alert(e + ': on line ' + e.line); }			// inform user of error  
	finally{ }  
} 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
function placeFile(placeFile) {  
    var desc21 = new ActionDescriptor();  
    desc21.putPath( charIDToTypeID('null'), new File(placeFile) );  
    desc21.putEnumerated( charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsa') );  
    var desc22 = new ActionDescriptor();  
    desc22.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Pxl'), 0.000000 );  
    desc22.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Pxl'), 0.000000 );  
    desc21.putObject( charIDToTypeID('Ofst'), charIDToTypeID('Ofst'), desc22 );  
    executeAction( charIDToTypeID('Plc '), desc21, DialogModes.NO );  
} 

function align(method) {
	var desc = new ActionDescriptor();
	var ref = new ActionReference();
	ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
	desc.putReference( charIDToTypeID( "null" ), ref );
	desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );
	try{
		executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );
	}catch(e){}
}

 

The problem is if the layer is Paragraph text layer the text must fill the verticals text box else there will be blank space under the text.  The nay be rectified if you rasterize the text layer but that would make the layer not editable.

image.png

 

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

"The problem is if the layer is Paragraph text layer the text must fill the verticals text box else there will be blank space under the text. "

 

So basically that means there is no solution?

 

I have a string of text from Excel in different lengths and it has to be imported and exported from PS as fart of batch data sets. The text must be on the bottom regardless of the lenght.

The layer is a paragraph (must be to accommodate different sentences that will fill the entire image or just the bottom).

The layer must be editable (interchangeable) with new data. 

 

This is not possible in Photoshop 2021?

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

You will not be able to automated it with Data Driven Graphics using Paragraph Text. If you do not keep replacement text within some length of characters so it will full the area,  You may be able to automate the process using two batch runs Data Driven Graphics followed be a batch script that would rasterize the Paragraph text layers and align  then.   Or you may be able to create a script to do all the needed processing. It depends in your scripting ability.

 

You may ba able to create a template that does not use Paragraph Text just use single line text layers. You design the Template.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

But I did use Paragraph text? 

 

The images I am sharing here in the topic are created from a file that has both text fields set as paragraphs.

 

In the upper one the title is OK, it is aligned to the right so longer and shorter words are fitting, but the lower text is all over the place and it should be on the bottom. 

I used this file to create images. 

Marinapomorac_2-1617629755259.png

 

Marinapomorac_0-1617629631769.png

Marinapomorac_1-1617629685308.png

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

I have never used Data Driven Graphics.  What you Posted looks like a contact sheet of your Data Driven Graphics output Jpeg Files.  Can Data Driven Graphics output Layered PSD files?   If it can you should be able to align the bottom text paragraph text layers the way you want them aligned.  You may be able to automate that process with Photoshop script you write. It depends on Data Driven Graphics being able to  save layered PSD files and then on how well you can script Photoshop.

 

If the Paragraph Text layer is the top layer in your template a Batched action may be able to align your text the way you want it aligned.  here are screen captures of the steps required.

Capture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

I have two columns in excel with 500 rows. 

 

I set the data set and click export and as a result, I get 500 PSD files. Then I use Image processing to convert the entire folder in to JPG.

 

I have to check this what you shared. Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

LATEST

Marinapomorac_0-1617640965089.png

 

YES!

 

That worked exactly as it should be.

 

Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

Things I solved:

a) how to merge PNG and JPG

I created PSD file with two layers, I called one JPG and the other one PNG. Then I created Excel file with two columns JPG and PNG and names PNG (1).png PNG (2).png and so on. Then I exported it to .text. Created variable PNG and JPG and data set from variable merged two files from folder. It is important that PNG JPG and .text are in same folder.

I run the batch and got a lot of psd then run script Image processor to convert all to jpg. 

 

b) Excel batch export - same as above just with text layers

 

c) unresolved - how to fix text to bottom

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines