Batch Replace Smart Object With Different Image Quality and Sizes

Hi there,
I need help. I have this template that is in 1000x1000pixel and 300 dpi. I'm trying to replace the smart object inside with various JPEG that I have. These JPEG comes in large image sizes but lower than 300dpi. The issues is, when I run the script that I have, some of the pictures become really pixelated. Beforehand, I resized them to fit into the empty place in sizes that I find fit the best (8 cm x 6 cm). Some of them work okey, but then some of them just pretty bad. I'm wondering if you can help me fix the script that I have so I didn't have to resized the images before running the script, and for all of them to automatically fit into my template without altering the quality of the image that I put in.
below is the script that I am using and the screenshot of my template:
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var theName= myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var thePath = myDocument.path;
var theLayer = myDocument.activeLayer;
// psd options;
psdOpts = new PhotoshopSaveOptions();
psdOpts.embedColorProfile = true;
psdOpts.alphaChannels = true;
psdOpts.layers = true;
psdOpts.spotColors = true;
// check if layer is smart object;
if (theLayer.kind != "LayerKind.SMARTOBJECT") {alert ("selected layer is not a smart object")}
else {
// select files;
if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", "*.psd;*.jpg;*.jpeg;*.tif", true)}
else {var theFiles = File.openDialog ("please select files", getFiles, true)};
if (theFiles) {
// work through the array;
for (var m = 0; m < theFiles.length; m++) {
// replace smart object;
theLayer = replaceContents (theFiles[m], theLayer);
var theNewName = theFiles[m].name.match(/(.*)\.[^\.]+$/)[1];
//Raise color picker for Back cover;
try {
app.activeDocument.activeLayer = app.activeDocument.layers[app.activeDocument.layers.length - 1];
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc7 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var idcontentLayer = stringIDToTypeID( "contentLayer" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref2.putEnumerated( idcontentLayer, idOrdn, idTrgt );
desc7.putReference( idnull, ref2 );
var idT = charIDToTypeID( "T " );
var desc8 = new ActionDescriptor();
var idClr = charIDToTypeID( "Clr " );
var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
desc7.putObject( idT, idsolidColorLayer, desc8 );
executeAction( idsetd, desc7, DialogModes.ALL );
} catch (e) {};
//save jpg;
myDocument.saveAs((new File(thePath+"/"+theName+"_"+theNewName+".jpg")),psdOpts,true);
////// get psds, tifs and jpgs from files //////
function getFiles (theFile) {
if (theFile.name.match(/\.(psd|tif|jpeg|jpg)$/i) != null || theFile.constructor.name == "Folder") {
return true
////// replace contents //////
function replaceContents (newFile, theSO) {
app.activeDocument.activeLayer = theSO;
// =======================================================
var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );
var desc3 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
desc3.putPath( idnull, new File( newFile ) );
var idPgNm = charIDToTypeID( "PgNm" );
desc3.putInteger( idPgNm, 1 );
executeAction( idplacedLayerReplaceContents, desc3, DialogModes.NO );
return app.activeDocument.activeLayer

Thank you for your answer.
I was resizing it before from bigger image size to a smaller one (121 cm to 8 cm) which fit my template size. But the dpi remains in 72 which makes the picture pixelized.
I am wondering if I can find a script that will keep the size of the first image that I put on the template for other images that I place, regardless the size they are imported to. Basically, how to make them all fit into the template regardless the size.
Thank you for the info about the scripting forum. I will write there too.
Sorry, I'm so new to this

Similar Messages

  • Optimize php page for browsers lacking flash, so that it replaces flash objects with static images

    Hello,
    I basically want to have my php pages with flash swf objects to be smart enough to replace the flash swf's with static images or other content for the non-flash user (iphone, ipad, etc.) who visits the website.  I guess this would be an option or perhaps a script that just sent the visitor to a version of the .php page that is tailored to them, a version of the page designed for non-flash users.
    I've done a little bit of reading up and have found that some people like to use DOM scripts like
    Unobtrusive Flash Objects (UFO) v3.22
    or what seems to be the successor:
    SWFObject 2.0
    What is better?  Is there a better script out there to use at this point?  Advice would be much appreciated.

    I guess I will reiterate this.
    I would like someone to tell me which one of these scripts that I have mentioned above would be best to use.
    What am I trying to do?  Well from my understanding these scripts allow me to have multiple versions of the website, so that it loads up with static images in place of the flash swf's for... NON FLASH USERS.
    The script will be able to detect whether the flash capabilities of the browser are sufficient, and if not display the web page accordingly.
    SO.  I'm looking for an answer as to what is the best script to use, if it's not one of the scripts I am asking about.
    @The Shocker.. if I wanted to research it on the net by googling, which I already have, I wouldn't be using this forum.  I'm looking for someone who is knowledgeable in this area of expertise to give me a recommendation, based on information they can give me that is logical and clear.  And then I can do further research once I feel I'm being sent in the right direction.
    Thanks in advance to anyone who would like to offer me some direction on this.

  • Replace smart object script

    Disclaimer: I do not know how to script, but am willing to learn and am looking for advice.
    I need to replace the text in a smart object from a data list then save the updated file using the smart object text. Is there an existing script that will do this?
    I cannot use a straight text layer because I'm performing a free distortion warp on the smart object that does not work on straight text. Using variables seems like a logical solution, but the only variable type for smart objects is "visibility".
    Plan "B" is to "replace smart object" with a series of PSD files containing the appropriate text. This works great, but I don't know how to automate it. I can easily create the series of PSD files using variables, but don't know how to automate their insertion into the template containing the distorted smart object.
    I'm looking forward to learning something new!

    I took a quick look at your script.
    I do not know where the the displacement map come in,
    The script seem the be replacing the object content of the current smart object layer.
    That layer can have had all sort of photoshop functions associated with it and has an associated transform.  All smart object layer have an associated transform and may have smart filters and filter mask as well.
    I see no code to handle the smart object size and make the replacement object have the same size or insure the replacement object is the aspect ratio and size.  Replacing  a smart object content does not change the current layer's associated the transform that transformed the original object. If the replacement object is not the same size as the original object the transform may not work like your expecting.
    An associated displacement map may come into play because of smart filters on the smart object layer. Displacement  maps content are either for the layers content or for lower layers content to make the current layer to conform to lower layers contours.
    In fact I create a four image picture package template that used a smart object for the image. Added CS2 for a file type that could be used to replace the image  in your script and ran your script.  It did pop up the ACR dialog if I select a raw file but it worked perfectly for my portrait cr2 files are the same size and aspect ratio. Ast the object.
    And a jpeg was saved to my desktop.
    When a different size landscape orianted portrait image is selected here is the result

  • I can't find the tutorial on replacing a person with another image from a different photo.

    I got an email with a link to a video a long time ago that showed how to remove a person from a group photo and replace this person with an image of them from another photo.  It does not seem to be in the videos on my Phtotshop elements 9 list within the program.  Does anyone have a link to this video so I can save it and rewatch it?  Thanks

      Click on the link below and go to: Easily Create the Perfect Photo
    It’s designed for several people but it should work with just one person in the shot. After viewing the tutorial open both images in Full Edit and go to:
    File >> New >> Photomerge Group Shot
    http://www.adobe.com/products/photoshop-premiere-elements/features.edu.html?promoid=GYSZM

  • How to copy objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution?

    I recently have bought a new Macbook Pro (Version 10.10.1) with the OS X Yosemite. The computer comes with the new Pages (version 5.5.1).
    Here is the problem: I like to create artwork using the shapes on Pages. Previously, on my old mac, I used Pages 4.3 to create objects, which I would copy then paste to Photoshop and it would become a vector smart object. However, in the new Pages (version 5.5.1), when I copy objects, they would appear on Photoshop as instead, a layer and it would not be in full resolution.
    Also, I know there is nothing wrong with the Pages file itself because I have converted the document to PDF form and it is high resolution when inserted into Photoshop that way.
    Does anyone know how I can copy individual objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution as I have done before?
    Thanks!

    ghotiz wrote:
    copy the image and have it in a high-quality PNG format that does not include the background from the Pages document.
    Oh, well if you don't actually need vector objects then it looks like this is possible. As I said earlier, Pages is putting a PNG on the clipboard. I tested it and it does paste into Photoshop as a transparent layer, because I can see the transparent background of the pasted PNG graphic if I either turn off all layers behind it in Photoshop, or if I start a new Photoshop document to paste into but make sure I choose Transparent for the Background Contents in the New Document dialog.

  • How to automate replacing smart object from folder?

    Hello!
    I have a layout in CS6, with an image that is a smart object. I have a folder of jpgs, and need to make comps from each of the JPGs. At the moment I take the master, double click the smart object. Place in the source JPG from the folder I'm working on. Save, back in the master, I export the updated layout for web. Then repeat.
    What I'd like to do, is use an action or script, that I could point to the folder of JPGs, and have it automatically, update the smart object with the JPGs export the comp as jpg for all of them.
    Is there a way to do this without being a programmer?
    Thanks
    Maxi

    Here's screenshots of a solution that doesn't require a script. You'll need to manually open the layout doc then open the SO but everything else is automated by Batch. Make absolutely sure that the SO doc is active when starting to record the Action and when you launch Batch. That's necessary for the "Select previous document" and "Select next document" steps to refer to the correct docs.

  • LR4.1 : "Edit-In" "Open as Smart Object with Photoshop..." feature doesn't work with 32bits

    Hi there,
    I am running LR4.1/CS5/ACR6.7 on a Win7 64bits system.
    The feature "Edit-In" > "Open as Smart Object with Photoshop..." does work Ok with raw files (.NEF).
    However, when i do try to use the same feature with 32 bits .TIFF files (which are output of the LR4.1's "Edit-In" > "Merge to HDR Pro in Photoshop..." other feature), nothing does happen (the Photoshop application windows does open but w.o the image that i've just selected).
    I've used search engines and Adobe online help to see if there was any limit preventing the usage of this feature with 32 bits .TIF files but couldn't see such note.
    Thanks for your help !
    Albert

    Thanks Rikk,
    That did work with a DNG file :-)
    I am working with very huge .TIF files (400MB), so i am wondering if size could be the main issue (although my PC has lots of HW resources).
    I will explore the DNG way, a format which seems anyways to be very promising now with LR4.
    In case anyone has an idea why it doesn't work the .TIF files, please shoot !

  • Using Smart Objects with Aperture

    I want to start using smart objects in Photoshop, but I really like Aperture as my main platform. If I use Photoshop as an external editor in Aperture, can I then use my plug-ins inside of Photoshop, returning flattened images to Aperture? Or will I have to convert to Photoshop as my main platform?

    To the best of my knowledge , Aperture saves the PSD file created when you open an Image with PS as an external editor with layers — and, because PS Smart Object are contained in layers — and Smart Objects intact as a new Original.  (Here in the Apple Aperture support forum we have followed Ernie's helpful distinction and call these "Quasi-Originals".)  Don't rely on my word, though — this is easy to test for yourself.
    Note, though, that flattening a file that is open in PS _always_ eliminates all layers, including layers that contain Smart Objects.
    In my workflow, I _always_ flatten PS files prior to closing the file in PS.  That workflow works for me (I don't value being able to undo/redo changes I make in PS).  I do this with a macro (using Keyboard Maestro).
    Decide what works for you.  Afaik, the choice of whether to save layers (and Smart Objects) is independent of your use of Aperture to catalog and adjust your Images.

  • How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    That feature is only in PS. Elements as you buy it has only limited support for smart objects. If you use File>Place to add something to your image it will come in as a smart object (within the limits to which PSE understands smart layers). However, if you know someone who can write an action for you in PS you can install it in PSE, or you could look into something like elements+ from simplephotoshop.com.

  • CS5 transform camera raw smart object with mask funniness?

    When I try and trasform a camera raw smart object that has a layer mask, the trasform box is not the size of the image, but is about a quarter of the image and it moves up to the upper left quarter of the image. If I first rasterize the smart object then add a mask it transforms just fine. Or if I rasterize the camera raw smart object, then make it a smart object and add a layer mask it transforms normally. So it appears to be an issue with transforming a camera raw smart object with a layer mask that is the issue. Is this a bug?
    Thanks,
    Steve

    I can't post the image publicly because of NDA, but I will pm you a link to the file. I don't always have this issue in cs5. I even tried opening up the same file in a new document and then made a mask and it transformed just fine. But it also is not limited to just this file, I have had this happen with other images as well.
    Thanks,
    Steve

  • Anyone try Smart Objects with Aperture; is this useful?

    Here’s what I did, wondering if this is helpful. I exported a master (which produces the RAW file) to disk.
    Open the image in Photoshop using the Aperture “Open with External Editor” command. Now use the Place Command and you can create a smart object with the RAW file. It initially opens Adobe Camera RAW so you can adjust as you wish. When done, you can save this SO in the version.
    Go back into that file from Aperture, and if you wish to edit again with Photoshop, you have the option of double clicking on the SO to call up ACR, tweak and save.
    So layers are not supported but Smart Objects are multiple versions of a PSD embedded in the original (if my understanding is correct).
    Am I crazy or does this allow us to do RAW conversions with ACR but use the rest of Aperture?

    That's a neat variation. Here's mine:
    http://discussions.apple.com/thread.jspa?messageID=1292903
    Summary:
    1) Export original to a hot folder which opens the file in ACR, convert.
    2) Apple-Tab back to Aperture, 'open in external editor'.
    3) Run an action that copies the image from the ACR conversion into the Aperture version and save. Action is included in the linked thread.
    Combining the two approaches could work rather nicely.
    Note - once an image has been opened using 'open in external editor' layers ARE supported. From this point on, 'open in external editor' passes the file directly to PS, without flattening. Just watch out for overwrites.
    Ian

  • Firefox mage quality and resolution was superb when I used XP and Vista. Now that I have Windows 7, however (with the Firefox 3.6.3 version), the image quality and resolution is poor. Please help me!

    I am using the Firefox 3.6.3 version with my new Windows 7 operating system. When I used all the previous Firefox versions in my XP and Vista operating systems, image quality and resolution was excellent! However, now that I have upgraded to Windows 7 and Firefox 3.6.3, the image quality and resolution is poor (unacceptable for downloading purposes).
    == This happened ==
    Every time Firefox opened
    == I first activated my new computer and installed the Firefox 3.6.3.

    All my images are pixelated in firefox 3.6.3
    http://www.dcgdcreative.com
    Not only on my site but on most sites I view.
    The issue is not solved by resetting the zoom text view (ctrl+0)
    The issue is not resolved by starting in safemode with add-ons disabled
    The problem seems to only affect .jpeg files and only on Windows 7 on my desktop; as I have viewed several sites using windows XP with my laptop, no issues.
    I had the same issue with IE8 and was able to fix the problem with by setting up the compatibility view for all sites. Issue fixed no problems at all. But nothing similar for firefox?
    Whats the deal?

  • Linking smart objects with it's layer mask

    ther must be a way to link smart objects with it's layer mask without having to rasterize....isn't there?

    You're pre-CS4 right?
    1) Upgrade to CS4
    2) Put SO in a group, link mask to group
    3) ...
    4) Profit!

  • Is it possible to create 2 Date objects with different hashcode.

    Hi,
    I want to create 2 java.util.Date objects with different hashcodes. Is it possible??
    Regards,
    Farooq

    import java.util.Date;
    import java.util.Calendar;
    public class TwoDates {
        public static void main(String[] args) {
            Calendar oneCal = Calendar.getInstance();
            oneCal.set(Calendar.YEAR, 1903);
            Calendar anotherCal = Calendar.getInstance();
            Date oneDate = oneCal.getTime();
            Date anotherDate = anotherCal.getTime();
            System.out.println(oneDate.hashCode() + " " +
                               anotherDate.hashCode());
    -14330615 -825112150

  • Is it posible to create objects with different names dinamically?

    Hi,
    I'm creating an app that manages different wireless nodes in a network and I was thinking that I could create a class called Node which would have a constructor that every time I created an object Node, I would pass the address and some other data about the Node and the constructor will save all that data and also create a unique ID for every Node object.
    Now the problem is that I need to be able to discover all the nodes in my network every time the user clicks a Ping button. So every time the users clicks Ping I need to do a ping and create as many Node objects as nodes I have in my network. The thing is I don't know how to make it create the node objects with different names so after I've created all the nodes objects I can refer to one of them.
    Something like this.
    int Id=0;
    id++;
    Node node+Id = new Node();
    I think its not possible to do something like that. If it isn't how can I do to refer to one of the objects I've created?
    Thanks.

    Twistx77 wrote:
    Thanks to both of you. I'll check out the Link and if I can't find the solution there I'll make the array , I don't know how I didn't think about doing that. There are two collections you should study specifically:
    First you have the ArrayList which in essense is a growable array. This means you don't have to decide in advance how big it can be.
    Second there's the HashMap. It's sometimes called an associate array. Such an array doesn't have fixed position indexes like an ordinary array. Instead each index (called key) is associated with a value but the keys don't have any particular order. Still, given a certain key, finding the corresponding value in a HashMap is almost as fast as an array access.

Maybe you are looking for

  • 4.08 update wont install

    My phone had the gingerbread update last night and phone was working normal today (with the exception of low space icon which had previously been popping up despite space being available) and then tonight I get a OTA for 4.08, press install and my ph

  • Movie Error

    I purchased and downloaded "The Italian Job (2003)" to my iTunes and iPod. However, whenever I try to play the movie, I get to the end of the opening credits and the movie stops. My iTunes tells me that I have an error and I exit the application. On

  • Streaming mp3 through Oracle/RealServer plugin

    Did anybody try to stream mp3 content from Oracle database through Oracle interMadia plugin for RealServer8? The RealServer8 itself plays mp3 files with no problem. I am having no problem to play native RealServer content (loaded from *.rm files) tro

  • External text dosn-t show Ş(S with cedilla) caracter

    external text file loaded in movie dosn't show Ş(S with cedilla) caracter, what should i do? if anyone can help please write to my e-mail [email protected]

  • Some windows-user could not see all images on the print result

    We have a Problem when printing images (blobObject). We are printing all displayed images immediately on the report. The images are represented on the report by Blob objects. At runtime we create a Bitmap object in memory, which is stored in a memory