PS_BRAMUS.TextConvert: PSD2TXT and TXT2PSD for the masses!

JSXWhat if you could extract all text strings from a PSD file into a TXT file? Sure, it’s possible, thanks to PS_BRAMUS.TextExport, the PSD2TXT script I wrote a few months ago. Now, what if you wanted to do that in the opposite direction and import strings from a TXT file into a PSD file (viz. TXT2PSD)? Look no further, PS_BRAMUS.TextConvert is here, and does both!

What is PS_BRAMUS.TextConvert

Don’t like reading? Member of the lazyweb? Savvy enough? You might as well just skip to the example then 😉

PS_BRAMUS.TextConvert is the successor of PS_BRAMUS.TextExport and consists out of two scripts:

  1. PS_BRAMUS.TextConvert.Export (PSD2TXT)
  2. PS_BRAMUS.TextConvert.Import (TXT2PSD)

The first script is a modded version of PS_BRAMUS.TextExport which scans your PSD file for text strings. After retrieving all text, the output is saved into a TXT file in your Documents folder.

The second script is the counterpart: it reads in TXT files (which you first exported via the first script) and replaces all text layers with the new content in your PSD file.

Is PS_BRAMUS.TextConvert something for me?

PS_BRAMUS.TextConvert is ideal for agencies/companies who need to translate Photoshop mockups: Export all text layers via PS_BRAMUS.TextConvert.Export to a text file, send that text file to the translation agency and let them do the translation, then import the translated file via PS_BRAMUS.TextConvert.Import into the PSD file.

PS_BRAMUS.TextConvert

Of course its usage is not limited to the example above. The Export part of PS_BRAMUS.TextConvert can be used for (speed)slicing for example

Requirements

  • PS_BRAMUS.TextConvert has been tested and verified working with Photoshop CS2 and up (Photoshop CC also supported)

Download / License

PS_BRAMUS.TextConvert released under a MIT license. Should you use the script within a commercial context, or if you want to put a smile on my face, please consider making a donation.

Download PS_BRAMUS.TextConvert

Note: PS_BRAMUS.TextConvert was made possible by means of lexia:park, Barcelona, Spain.

Installation

  • Download PS_BRAMUS.TextConvert from the link above
  • Extract it to the Presets/Scripts folder of your Photoshop installation folder (defaults to C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts on Windows)
  • Restart Photoshop if it was already running (important!)

How to use PS_BRAMUS.TextConvert

Once installed, usage is simple:

1. Exporting text (PSD2TXT)

PS_BRAMUS.TextConvert.Export

  • In Photoshop go to File > Scripts and select PS_BRAMUS.TextConvert.Export-1.0 from the list to export all text.
  • Per open PSD file, a TextConvert-[NAME_OF_YOUR_PSD_FILE].txt file will appear in your Documents folder
    (if multiple files are open, you can choose to only run PS_BRAMUS.TextConvert.Export on the currently active file or on all files)
  • After the export was done, you’ll get a little notification of this
    (if PS_BRAMUS.TextConvert.Export ran with a single file, the .txt file will open instead)

2. Reworking text

  • Locate the exported .txt file in your Documents folder and open it with your favorite text editor
  • Translate the strings you find in there, but make sure that you leave the [BEGIN /XXXX ] and [END /XXXX ] lines untouched! (If changed importing will fail)
  • Save the text file with the same name in the same location.

3. Importing text (TXT2PSD)

PS_BRAMUS.TextConvert.Import

  • In Photoshop go to File > Scripts and select PS_BRAMUS.TextConvert.Import-1.0 from the list to import all text.
  • Per open PSD file, the script will look if the TextConvert-[NAME_OF_YOUR_PSD_FILE].txt file exists in your Documents folder, read it in (if it exists) and update the text layers of your PSD file
    (if multiple files are open, you can choose to only run PS_BRAMUS.TextConvert.Import on the currently active file or on all files)
  • After the import was done, you’ll get a little notification of the number of files updated
    (if no txt files were found, then it will state that 0 files where changed)

Warning!

  • Please note that PS_BRAMUS.TextConvert.Import is not compatible with any version PS_BRAMUS.TextExport!
  • Please note that in between the running of the Export and Import NO CHANGES TO THE PSD FILE can be done!

Example

Given the fact that the image pictured on the left is a normal Photoshop file (viz. background layer, image elements on different layers, text layers, layer groups, etc) I’m quite sure the figure below explains it all:

PS_BRAMUS.TextConvert.Example

Now, did you download PS_BRAMUS.TextConvert already?

Did this help you out? Like what you see? Consider donating.

☕️ Buy me a Coffee ($3)

It certainly is no obligation but it would put a smile on my face. Thanks! 🙂

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Join the Conversation

37 Comments

  1. wonderful! I will be donating today! 🙂

    A question please: I would like to run the script on multiple files. What can I do instead of manually opening/closing all the files? I thought of batch processing, but the menu file>>automate>>batch… only works with actions, not with scripts 🙁

    thanks for your help!

  2. PS: regarding my previous comment:
    I meant, I would like to run the script on all files in a given folder.

  3. First of all great idea as I need to do some translations. I am
    trying this with CS5 and I get an empty text file, any idea what I could be doing wrong? I get the script in the scripts menu and
    I selected the export script and an empty text file opened.
    Any help would be appreciated.

    Thanks,

    Luis

  4. Great idea indeed! I was excited *_____*
    Have run it on PS4 Portable. Seems not to work with Korean text though. Works with Latin and Cyrillic characters.

    Sorry, I cannot donate as I’m not able to use PayPal. What about Webmoney?

  5. No worky with CS5 and foreign languages – tried with 32bit and 64bit PS versions and it just hangs the application…to bad I really need this…

  6. Hi Bram, I just sent you an email but I thought I might leave a comment too as I’m hoping to get a response quite desperately and this might help others in the future with the same issue.
    First of all thanks so much for developing such a great plugin.
    I have a problem, when I reimport the txt all the content comes in ok but the text size changes of many of the layers. Do you know what might be causing this?
    I’m using Mac and CC Photoshop.
    Thanks in advance for your response!

    1. Hi Max,

      Good thing you’ve also replied here as it looks like I didn’t get your mail.
      Regarding the issue you’re having: this isn’t something I’ve encountered myself before, nor have heard from anyone else.
      Does it happen with *all* PSDs, or just one?

      Regards,
      Bram.

  7. Tried on CC 32 bit and it works… but not with Russian. French and Spanish seem OK.

  8. Hello,
    Is there anyway of extending this functionality to cover smart object layers?? that would be amazing

  9. Hello,
    This is a great plugin – Thank you!
    However, I would really like to be able to specify the location of the extract file.
    I’ve never done any scripting but I’ve had a look at the file and I’ve found the bit I would need to change but I have no idea how to change it.

    What would I need to do?

    Thanks again 🙂

  10. this script is great but is there anyway that it can word doc can be populated in reverse. My PSD files once exported as a text file has the copy from the bottom layer at the top of the word doc and continues down – my very first layer from photoshop is at the bottom of the text doc. is there a way around this?

  11. Hi Bramus, this script does not maintain the same character formatting when we import text, for eg. if any paragraph has multiple styles (like bold, italic, etc) it does not remain in same formatting when we import text. Do you have any solution for this?
    It would be a great help for me.

  12. Hi Bramus,
    I use Windows10, Photoshop 64 bits CS6 and your script PS_BRAMUS.TextConvert.Export.jsx
    The script gives an error:
    ———————————————————
    Fout 60:Onjuiste vorm (ongeldig token).
    Lijn: 627
    -> function initTextConvertExport() {
    ———————————————————
    I tried your script about a year ago with the same result and then removed it from Photoshop and left it as it was. I now downloaded your script again, reinstalled it but still this error.
    Any advice on this?
    Frank

  13. Hi Bramus,
    This is exactly what I need! However, when I try to import strings from a TXT file into a PSD file, the script does not maintain the same character formatting, for eg. if any paragraph has multiple styles (like bold, italic, etc) it does not remain in same formatting. How can we fix this bug? Thanks in advance.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.