Combine Text File & Image

I am needing a script that will take a text file that has an image URL and 2 lines of text and create one image out of the URL image with the 2 lines of text underneath it all in one image.
So the text file would contain:
http://www.url.com/to/image
Text Line 1
Text Line 2
I need the final image to look like the file I have attached:

well, this is 95% there.  The last request (the 3x4 card thing) is possible, but involves some complexities. Image Events can scale images, but it only does it by proportion or pixels, so without knowing the dpi or initial size of the images in question I don't know how best to do the calculations.  are the images all the same size, orientation and resolution, or will we have to dig the info out on a per-image basis and do the math?
At any rate, here's what we have so far, in three parts.  Create a folder called Source Folder on the desktop (or change line 2 of the script to point to a preferred folder location).  You'll need to make two plain-text files in that folder with the following contents:
1. data file.txt
http://www.freeimagesarchive.com/data/media/223/waterfall.jpg"
So long!
And thanks for all the fish!
2. template file.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body>
<img alt="" src="***ImageSource***"
height="400" width="600"><br>
<br>
<font face="Lithos Pro"><b>***Text1***</b></font><br>
<br>
<b><font face="Lithos Pro">***Text2***</font></b><br>
</body>
</html>
Copy the following script into the applescript editor and run it.  it will (knock wood) create a jpeg file in the Source folder.
-- I'm putting intermediary files in /tmp so you don't have to think about deleting them
set tempFolder to (do shell script "mktemp -d /tmp/temp.XXXX") & "/"
set sourceFolder to POSIX path of (path to desktop from user domain) & "Source Folder/"
-- set up convenience paths
set dataFilePath to sourceFolder & "data file.txt"
set htmlTemplatePath to sourceFolder & "template file.html"
set htmlWriteoutPath to tempFolder & "tempHTML.html"
set pdfWriteoutPath to tempFolder & "tempPDF.pdf"
set finalImagePath to sourceFolder & "output image.jpg"
-- read the data file
set {imageSource, lineOne, lineTwo} to paragraphs of (read dataFilePath)
-- get, modify and save the html template
set htmlText to read htmlTemplatePath
set htmlText to swapText(htmlText, "***ImageSource***", imageSource)
set htmlText to swapText(htmlText, "***Text1***", lineOne)
set htmlText to swapText(htmlText, "***Text2***", lineTwo)
set htmlWriteoutPath to tempFolder & "temp.html"
set fp to open for access htmlWriteoutPath with write permission
write htmlText to fp
close access fp
-- convert to pdf
do shell script "cupsfilter " & quoted form of htmlWriteoutPath & " > " & quoted form of pdfWriteoutPath
-- convert to jpeg
tell application "Image Events"
          set thePDFImage to open pdfWriteoutPath
  save thePDFImage as JPEG in finalImagePath
  close thePDFImage
end tell
-- utility handlers
on tid(input, delim)
  -- generic text item delimiter handler
          set {oldTID, my text item delimiters} to {my text item delimiters, delim}
          if class of input is list then
                    set output to input as text
          else
                    set output to text items of input
          end if
          set my text item delimiters to oldTID
          return output
end tid
on swapText(input, x, y)
  tid(tid(input, x), y)
end swapText

Similar Messages

  • How do I combine text and image on same screen?

    How do I comgine text and an image on the same screen in Final Cut Express 4.  I have had to use scrolling text and then import a graphic.  I want the text and graphic on the same page.  Thanks .

    Place your video clip (or still image clip) on track v1.  Then place your text clip immediately above it on track v2.  The text will overlay the image.  (Note: it doesn't necessarily have to be v1 & v2 - what's important is that the text clip be on a video track higher than the video clip/image clip.)
    Generally best to use white text, sans-serif font, larger than you might think you initially wanted.

  • Combine text and image as submit in Struts

    Hi,
    I would like to make a submit with a little button AND text, like
    "here is image" Research
    I'm forced to use Struts, so that the html tag <a href> is not usable.
    Can anybody help me?

    You can allways use the
       <html:link action="myAction"/>
       </html:link> Or if you don't have the requirement that your pages have to work even with JavaScript disabled you can allways do the following:
       <a href="#" onclick="javascript:forms['myForm'].submit(); return false;">
       </a>

  • Combining text and image

    Ok, I have a what hope is an easy to solve problem:
    I have a BufferedImage that shows what a Swing component looks like, like a screenshot. This is how I create it:
    BufferedImage i = new BufferedImage(this.getSize().width,this.getSize().height,BufferedImage.TYPE_INT_RGB);
            Graphics2D gg = i.createGraphics();
            this.paint(gg);I want to add some text below it, and save the whole as an image. I have no idea how to enlarge the image, so that the text is below and not over it, nor how to add the text, except for the drawString method.
    So far I have this:
    Graphics2D g2 = i.createGraphics();
    i.drawString(mytext,0,100);and it doesn't even show the string, only the image just as it was after creating it at the first time.
    Any ideas? Pretty please!

    You may want to look into the [Laying Out Components Within a Container|http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html] tutorial as well as the [LayoutManager API|http://java.sun.com/javase/7/docs/api/java/awt/LayoutManager.html] .
    Edit: You might even want to bookmark the entire [Really Big Index|http://java.sun.com/docs/books/tutorial/reallybigindex.html] as its an unbelievably helpful source of information to get started with java. And it is named very sympathetic, too - try to find something like that in c++. :)
    Edited by: anotherAikman on Oct 12, 2009 4:54 AM

  • Importing text file (with file names) into Automator.. is it possible?

    Hello all,
    I have been working with Windows Batch files for my line of work. I have a couple of file names in a text file (a column), which I want to copy from one folder of one hdd to another folder on a different hdd. I have been trying to do this kind of work with a Mac. I already know how you copy and rename files in automator (which isn't difficult, of course) but you have to 'select' the files in the finder first (with get specified items).
    But the only way i see that you can specify items is by selecting them... is there a way to import a text file with all the file names instead of selecting all the file names manually?
    or is there an AppleScript alternative which I can use to import the text file (or just copy into applescript) and run before the query's of copying and renaming the files? I am kind of new to Apple programming.
    The text file looks like this:
    image1.jpg
    image2.jpg
    etc..
    so there has to be a command to: 'goto' a specific folder as well.
    Thanks in advance!

    You can import text files, but if they are just names you will need an additional action to add the source folder path. A *Run AppleScript* action can be used, for example:
    Tested workflow:
    1) *Ask for Finder Items* {Type: files } -- choose the text file containing the names
    2) *Combine Text Files* -- this gets the text file contents
    3) *Filter Paragraphs* { return paragraphs that are not empty } -- skip blank lines
    4) *Run AppleScript* -- copy and paste the following script:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 680; height: 340px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- add folder path
    add the specified folder path to a list of file names
    input: a list of text items (the file names)
    output: a list of file paths (aliases)
    set output to {}
    set SkippedItems to {} -- this will be a list of skipped items (errors)
    set SourceFolder to (choose folder with prompt "Choose the folder containing the file names") as text -- this is the folder containing the names
    repeat with AnItem in the input -- step through each name in the input
    try
    set AnItem to SourceFolder & AnItem -- add the prefix
    set the end of the output to (AnItem as alias) -- test
    on error number ErrorNumber -- oops
    set ErrorNumber to ("  (" & ErrorNumber as text) & ")" -- add the specific error number
    set the end of SkippedItems to (AnItem as text) & ErrorNumber
    end try
    end repeat
    ShowSkippedAlert for SkippedItems
    return the output -- pass the result(s) to the next action
    end run
    to ShowSkippedAlert for SkippedItems
    show an alert dialog for any items skipped, with the option to cancel the workflow
    parameters - SkippedItems [list]: the items skipped
    returns nothing
    if SkippedItems is not {} then
    set {AlertText, TheCount} to {"Error with AppleScript action", count SkippedItems}
    if TheCount is greater than 1 then
    set theMessage to (TheCount as text) & space & " items were skipped:"
    else
    set theMessage to "1 " & " item was skipped:"
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SkippedItems, AppleScript's text item delimiters} to {SkippedItems as text, TempTID}
    if button returned of (display alert AlertText message (theMessage & return & SkippedItems) ¬
    alternate button "Cancel" default button "OK") is "Cancel" then error number -128
    end if
    return
    end ShowSkippedAlert
    </pre>
    5) *Copy Finder Items* { To: _your external drive_ }

  • Acrobat XI Pro: Text boxes empty after combining PDF files

    I have a user when she combines a few documents only one document is missing some text in text boxes that were showing up before.  Here is a screen shot of the two files:
    The document on the left is what occurs after the files have been combined, the document on the right is the original document.  I spoke with tech support, they told me to take the original pdf document then print it to the adobe pdf printer and select the option to print it as an image.  Then when we combined the files it was working fine.  I also took the original Excel 2010 document that the right document in the image came from, printed that to the Adobe PDF printer and made sure it printed it as an image.  Then after combining them it worked once more.  My problem is the user didn't have to print the excel doc to an image, she would just have to click on the Acrobat tab in Excel and tell it to create a pdf doc.  So is there a setting I'm missing?

    I tried uninstalled Acrobat XI and installed Acrobat X but the problem still exists.  I spoke with my user some more and found that if she leaves out one of the documents from the combining process this issue does not occur. So either this is a font incompatibility or that document that was left out is corrupt.  Any thoughts?

  • Possible to scan a document into Acrobat XPro,then replace part of that PDF with text or image file?

    Hi everyone,
    Is it possible first to  scan a paper document into Acrobat X Pro, and then to replace a "pane" or box within that PDF with a text or image file?
    Would it require  SDK and Javascript?
    Thanks,
    Rick Weinhaus

    CtDave and others:
    Here's the problem in more detail.
    I am a physician and I already have the ability to incorporate paper-based
    documents into an electronic health record (EHR) by scanning them and
    saving them as PDFs.  The documents are paper patient encounter forms with
    a different box or 'pane' for each category of data.   Each box has a fixed
    location on the paper form.
    There are three situations, however, where I want to have the option to
    overwrite certain boxes of the PDF with data generated by methods other
    than scanning.
    1) Insert text macros with variable fields using the electronic health
    record's software.
    2) Insert a drawing available as a pre-existing JPG or generated by using a
    tablet.
    3) Insert text generated using Dragon Naturally Speaking.
    For efficient office workflow, in all three cases the text or image to be
    inserted into the box or 'pane' in the PDF needs to be generated while I am
    still seeing the patient -- that is -- before the paper form has been
    scanned and converted to a PDF.
    The sticky note tool is one option, but I would want to be able to modify
    the default size of the sticky note so that it corresponded exactly to the
    size of the box it was 'overwriting.'  I can't figure out how to do this?
    Could it be done using scripting?
    Furthermore, I would want the sticky notes to automatically display when
    the PDF was opened, so that a hover would close rather than open them.  This
    sticky note method would have the advantage of allowing the user to toggle
    back and forth between inserted data and any original handwritten text.
    Any thoughts?
    Rick

  • I want to embed text AND image from same XML file

    Hey,
    I got following problem:
    I want to put 1 image AND my text in 1 external XML file.
    I can load either one of them in seperate XML files.
    I need this because I want my content to be scrollable on my website and with this my image has to scroll with my text.
    I got following AS3 put in now:
    (ACTIONSCRIPT3.0)
    //LOADING EXTERNAL XML & IMAGE//
    var xml:XML;
    var urlRequest:URLRequest = new URLRequest("externaltext/welkom_content.xml");
    var urlLoader:URLLoader = new URLLoader();
    urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
    urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
    urlLoader.load(urlRequest);
    function urlLoader_complete(evt:Event):void {
        xml = new XML(evt.target.data);
        welkom_content_text.text = xml.toXMLString();
    //LOADING EXTERNAL PICTURES//
    var xmlData:XML=new XML();
    var pHeight:Number = 200;
    var pWidth:Number = 200;
    var listLoader:URLLoader = new URLLoader( new URLRequest("externaltext/testxmlimage.xml") );
    var picLoader:Loader = new Loader();
    listLoader.addEventListener(Event.COMPLETE, gotList);
    function gotList(evt:Event):void {
       var xmlData:XML = XML(listLoader.data);
       var numImages:Number = xmlData.pix.length();
       var stImage:String = xmlData.image
    picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, gotPic);
    picLoader.load( new URLRequest(stImage) );
    listLoader.removeEventListener(Event.COMPLETE, gotList);
    function gotPic(evt:Event):void {
    var thisBmp:Bitmap = Bitmap(evt.target.content);
    thisBmp.x = 0;
    thisBmp.y = 0;
    var thisWidth:Number = thisBmp.width;
    var thisHeight:Number = thisBmp.height;
    thisBmp.scaleX = pWidth/thisWidth;
    thisBmp.scaleY = pHeight/thisHeight;
    addChild(thisBmp);
    picLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, gotPic);
    (/ACTIONSCRIPT3.0)
    And my XML file for the text content is as following:
    (XML TEXT FILE)
    <?xml version="1.0" encoding="utf-8"?>
    .... ALL OF MY CONTENT
    (/XML TEXT FILE)
    And for my image the XML file is as following:
    (XML IMAGE FILE)
    <?xml version="1.0" encoding="utf-8"?>
    <imagelist>
    <image>externaltext/testpicxml.jpg</image>
    </imagelist>
    (/XML IMAGE FILE)
    Does anyone know how to fix this and how to do it?
    Thanks in advance!
    Every help is appreciated!

    Thanks!
    And again... I'm doing some things wrong.. I feel dumb!
    Trying to make a website in ASP.NET almost whole day, so my head isn't set to AS3 at all..
    My code now to embed XML looks like:
    var xml:XML = new XML();
    var XMLURL:String = "externaltext/welkom_content_pic.xml";
    var myXMLURL:URLRequest = new URLRequest(XMLURL);
    var myLoader:URLLoader = new URLLoader(myXMLURL);
    var page:Sprite = new Sprite();
    myLoader.addEventListener("complete", urlLoader_complete);
    function urlLoader_complete(evt:Event):void {  
    addChild( page );
    page.addChild( welkom_title_text );
    page.addChild(  welkom_content_text );
    page.addChild(  welkom_image_holder );
    xml = new XML(evt.target.data);   
    welkom_title_text.text = [email protected]();   
    welkom_content_text.text = xml.item.toString();       
    //use URLLoader to load the image from the path [email protected]()
    Probably set some things wrong..
    And what exactly do I have to set to load my image with it?
    We were all a beginner once.. but I'm the uber annoying beginner I think... hehe
    I probably won't be answering untill thursday, because I got a day off, so..
    Thanks!!!!!!!!!!!!!!!!

  • How to invoke alt-text for images in a PDF file by Automation

    Hi,
    Can any one help me?
    How to invoke Alt-text for Images in a PDF file using script?
    Thanks for looking into this.
    Regards,
    Sudhakar

    What do you mean "invoke" alt-text?  If Alt-text is there, then it will be presented to a screen reader.

  • I am trying to convert an Illustrator cs6 file to a PDF and every time I do it, I lose all text and images. Can someone provide some assistance? Thank you!

    I am trying to convert an Illustrator cs6 file to a PDF and every time I do it, I lose all text and images. Can someone provide some assistance? Thank you!

    It's always a good idea to supply platform and AI version info.
    How are you "converting" the file? Are you choosing "Save As" and selecting PDF from the file format options? This will bring up additional save options. I would suggest "Illustrator Default" setting unless you have specific needs.

  • Renaming Images from Text File

    Hello,
    I am trying to rename images in a folder to match the names within in a text file. The names in the text file are all unique, so using a rename batch like example-1.jpg, example-2.jpg, etc. won't work. I have matched the structure between both the name and image file, so I need automator to traverse down the text file and add each unique name to the corresponding image.
    If anyone has some help for this it will greatly be appreciated! Thanks

    I wrote you a shell script that will do the job.
    First, put all your images into a folder (if you haven't already done so). Make a copy of the folder for safety's sake (I tested the script and it should work fine, but it's always good to have a backup).
    Now, make sure each new name in the text file is on its own line. Rename the file to "list.txt" and put it in the same folder as the images (better make a copy of the list, too).
    Now, download this file: http://danielrichman.com/tmp/file_rename.sh
    Put it in the same folder as your images.
    Now, open Applications -> Utilities -> Terminal and type the following (without quotes):
    "cd "
    Then open up the Finder window that contains the images. In the title bar of the window, there's a little folder icon. Drag the icon into the Terminal window. (You should see the path copied.)
    Then, in Terminal, press enter.
    Then copy this (and press enter at the end):
    "chmod a+x ./file_rename.sh"
    Then, do this:
    "./file_rename.sh"
    That should be it! Please let me know how it goes.
    Good luck!
    ddr

  • How can I get Aperture to dump the photo info on RAW images as a text file?

    When I am uploading files to something like dpReview I often want to provide information on the various aspects of the photo. Most of what I want to be show appears in the METADATA tab under photo info. Is there any way to dump this data for each image as a text file either during the export of the RAW to JPEG or otherwise?

    When you export a master you can create an accompanying IPICT4XMP Sidecar File, that contains the IPICT data. It is not plain text file, but you can open it wit a text editor (Xcode, if you have it) and copy the metadata from there.
    To create the the sidecar file set the Metadata selector to "createIPICT4XMP Sidecar File"

  • Can't see imbeded images in text file

    files created on macbook (tiger) going to new macbook (lion)
    Files have imbeded images and font style changes via tex-edit but on lion files just show as plain text (no images).
    How do we retain the images and font style changes?

    saving on old machine as rtf
    move to new machine
    but not all edit programs recognize the rtf
    but some did
    thanks

  • Loading an image in an XML text file

    I've gotten the DateChooser component to work very well
    loading dynamic text fields with data from an external XML file.
    Can I embed a jpeg into the XML text like I would with the
    <img> tag in an HTML text file?
    Many thanks in advance for any tips...
    George

    I assume your XML looks something like this...
    <event date='11/11/1111'>
    <PerformerName>SomeInfoHere</PerformerName>
    </event>
    You could add the image info anywhere you want in the XML.
    Perhaps an attribute of the PerformerName tag?
    <PerformerName
    image='myImage.jpg'>SomeInfoHere</PerformerName>
    or
    <PerformerName image='
    http://www.myDomain.com/images/myImage.jpg'>SomeInfoHere</PerformerName>
    When you parse the XML data and build your Array, then you
    just need to capture the additional tag attribute. Similar to how
    you got the date attribute.
    Then at that point you would add it into the textField of
    your info_txt.
    Read this page in the docs to see how to add the image.
    http://livedocs.adobe.com/flash/8/main/00001464.html

  • Automate combining PDF files based on a text list of URL's

    I'm wondering how I could automate the combination of PDF files into one, using a list a URL's in a text file (one URL per line, each pointing to a PDF file).
    I need to periodically rebuild a combination of PDF files, with the URL's staying the same, but the files behind getting updated. I'm not a Javascript developer, so I'm doing that "manually" by copying and pasting each URL into the "Combine Files" window, but it would be great if I could get Acrobat to read them off a text file.
    Thanks!
    Corrected typo

    I have developed a script that can do just that, but with locally saved PDF
    files:
    http://try67.blogspot.com/2009/10/combine-pdf-files-from-text-list.html
    It might be possible to adjust it to do what you describe. If you're
    interested, contact me personally by PM or at try6767 at gmail dot com.

Maybe you are looking for

  • Spent a good hour on all of this and still the same problem, Im done with CL products for go

    I do all this to the T as the Creative Labs tech asked me to and I still have a stuck mute button on my windows sound properies and as I sais earlier whenever I change the REC in Surround mixer it automatically muts anything I select it to. I have al

  • Problem while triggering IDoc

    hi, When i am triggering idoc from R/3 , it is saying idoc transferred to port, but when i am checking the idoc in XI system idx5 , i am not able to view the idocs, What could be the reason for this? Also when i am creating distribution model in BD64

  • Problems with decoding an latin1-encoded url

    Hi, i have a problem with decoding german umlaut-characters from an URL. I'm using Tomcat 5.5 on a Linux server and one on a windows machine for development. Both webapps have the same configurations. A servlet decodes the URL-String, parses it and s

  • Itunes 11.0 song recommendations not there.

    When in a playlist, itunes 11.0 no longer shows a list of recommended new songs on the right side of the screen to purchase from the itunes store.  I don't want Genius recommendations from my own library.

  • Changing date format to look like dd-mm-yyyy

    I want to use the date format as 25-12-2010 (day-month-year). I could not find how. Is there a place to change that? Can I make custom formats for dates? Hursat