Layer comps to files with auto trim - photoshop-script

I am using the modified 'Comps to files.jsx' script to export my layer comps (using the label of the layer comp as my file name)
http://www.ps-scripts.com/bb/viewtopic.php?f=9&t=5277
It is a great script and makes my worklfow so much easier.
The only thing missing for me is a trim option, as some of the layer comps have different heights
After I ran the script, I have to manually crop all the jpgs in PS and then save them out again.
In the default 'Layers to Files' script that comes with PS, there's an option to auto trim .png's when exporting the layers.
Any help on the following questions is much appreciated:
I've modified the original 'Comps to files' script and I now have the option (if I choose png as my file type) to trim the layer, but when I open the exported file it din't crop it.
http://adobe.ly/1r3f3nZ
Is there an option to auto trim jpgs?
Thank you

Related

Batch command to overlay 2 PNGs on top of each other

I am in the process of finalizing the creation of graphics and try to automate the overlaying of two PNGs (which have the same size).
I have 2 folders with fixed directories, for example let's say "C:\Users\User\Desktop\Backrounds" and "C:\Users\User\Desktop\Overlays".
The files in "Overlays" are named as follows: "ID-RandomNumber-Backround.png". The variable "Backround" can be "Blue", "Red" or "Yellow".
The files in the "Backrounds" folder are the future backgrounds - named (you almost guessed it): "Blue.png", "Red.png" and "Yellow.png".
My goal at the moment is to write a script, which automates ALL files from the folder Overlays with the corresponding backgrounds (depending on the file name) from the folder Backrounds to provide - so the PNGs in the right order to put on top of each other. So the file "001-2812-Blue.png" should get the background named"Blue.png", the file "002-2612-Yellow.png" should get the background named "Yellow.png" and so on.
I'm using Windows 10 and have thought of a batch script that does this work via imagemagick and composite. Unfortunately, I am currently somehow completely lost, what a possible script could look like. Probably I'm just standing on the hose.
I would be infinitely grateful if you could give me a hint how a possible script could look like. Thank you!
If you have any questions or need more information, just let me know!
To make it a little bit clearer what exactly I have in mind, you can find a little graphic enclosed that shows what I have in mind - maybe it helps a little bit :)

How to replace text in Gimp image programatically

As in the title - imagine there is some Gimp .xcf file containing many layers. Part of these layers contain text. Is there any format I can export .xcf file to, that it somehow preserve 'human readable' text ?
The final goal is to process that text and put it again into the file, I am aware that this sounds unusual but maybe some of you have an idea how to achieve scenario like that.
I did some research and I saw I can export image to .psd format and then using NPM package process that image and extract text. This is just partially solves the problem, because I will not know how to put the processed text back into this .psd file (unless I decompile this NPM package and try to write some implementation myself...)
Any solutions and alternatives higly appreciated
You can script Gimp (using Scheme or Python). Technically you cannot change the text in a layer (there is no API for that), but you can recover the characteristics of a text layer (original text, font type, font size...) and recreate a new layer with a new text. Here is some Python code to recover the text information:
def text_info(img,layer):
parasites=None
try:
parasites=layer.parasite_list()
except Exception as e:
pass;
if parasites and 'gimp-text-layer' in parasites:
data=layer.parasite_find('gimp-text-layer').data
pdb.gimp_message('Text layer "%s": %s' % (layer.name,data))
else:
pdb.gimp_message('No text information found for layer "%s"' % layer.name)
(this information is only present of the file has been saved, it is not available on a newly created layer, but this shouldn't bea problem in your case)
Of course if the text is in a plain bitmap layer of its own this cannot be done, you have to guess the font type & size (but sometimes the code above can still recover the text information)
But if your XCF has a simple structure, it can be a lot simpler to decompose it into individual images, and build a new image with ImageMagick, using some of these layers plus new text images (or directly rendered text).

Generate single PDF from multiple Asciidoc files

I'm trying to convert my existing asciidoc documentation into pdf. Asciidoctor-pdf seems quite easy and I'm able to convert single files into pdf.
asciidoctor-pdf -a pdf-theme='./theme/styles.yml' -a pdf-fontsdir='GEM_FONTS_DIR, theme/fonts/' 01-intro.adoc
But my docs are spread across many files. I want do create a single pdf from all those files. Does anyone know how to do this?
Secondly I don't want the generated pdf to be located next du the adoc file. I want to specify a target path.
I'd appreciate every hint. Thanks and best regards. Sebastian
(Dec 26, 2021)
The easiest and most convenient way is to use the VSCode editor with the AsciiDoc extension installed. This extension is developed by the same team that develops the AsciiDoctor text processor. This is a GUI-based approach to solve all your problems so I'm pretty sure u're gonna love it.
(Step 1) After the extension is installed, use the keyboard shortcut Cmd + , to go to the settings and then enter asciidoc.use_asciidoctorpdf in the search bar and tick the check box (see the demonstration below)
(Step 2) To create a single pdf file from multiple .adoc files, just simply put all of them in a single .adoc file with include::directory-to-the-adoc-file.adoc[] (see the illustration below)
(Step 3) Press F1, then type in as pdf and hit Enter to export this single .adoc file as a single PDF file, this will allow u to specify the target export directory for the PDF. Please be patient and wait for a few seconds for the export to complete, the editor will immediately inform u as soon as the export is complete (see the image at the bottom)
Have you considered to work with includes?
Just add to your document "01-intro.adoc" an any position this line:
include::02-next-file.adoc[]
When you build the 01-intro.adoc with your regular command, the contents of 02-next-file.adoc will be put to the position of the include line. Using this method we create a file with many includes and just build that file. We're very happy with that.

Customization of the plot appearence in XMGRACE

I create png graphs using xmgrace via the bash script working from the terminal w/o gui:
gracebat *.xvg -hdevice PNG -fixed 400 260 -printfile *.png -hardcopy
could you suggest me commands (or alternatively a script for the batch mode) which will customize the output graphs? In particular, I would like to increase the size and the font along the XY axes and customize the legend.
If xmgrace is not a good editor, could you suggest me another command-line utility for linux with better options for the graphs visualization?
Thank you!
In addition to grace batch files, you have a few more (non mutually exclusive) options:
You can use a custom Default.agr (see here for an example) to improve the visual appearance of your plots out-of-the-box
You can use parameter files: create a plot (with legend and all) and use the "Load -> Save parameters..." menu option to save a parameter file. From bash, use the -param switch to use that parameter file with other sets of data (e.g. gracebat *.xvg -param myparams.par -hdevice PNG -fixed 400 260 -printfile *.png -hardcopy).
You can use (or write) a utility program to automatically edit .agr files (which are plain text files). A really nice one is pygrace. With pygrace you can easily write python scripts that generate or edit agr files in a very straightforward way.

Any CLI tool to perform 3d texture mapping on the fly

I'm currently looking for a way to create a 'configurator' for a upholsters, similar to http://digitaldraping.com/configurator/furniture-sofa/?Cushions_Plain-Cream.png,Sofa_Stripe-Orange.png - you select your fabrics and they are 'drawn' on the sofa automatically.
Unfortunately, all the sites I've looked at seem to use pre-rendered transparent PNGs that are overlaid over each other to build up the full picture. The problem here is that we've figured out that we'd require over 120,000 different images to cover all models, fabrics etc!!
I've looked at a few 3d texture tools such as http://www.arahne.si/products/arah-drape.html, hoping that one of them would have a CLI option where you give it a pre-created wireframe, and a fabric to overlay, and it generates the required image on the fly, but so far everything seems to require real-time use of the GUI to use it.
So, is there a CLI tool that would do what I'm after, or can anyone suggest a way to manipulate the GUI automatically? (from a tech point of view, I'm comfortable with C, Bash, Python or PHP as a solution!)
Thanks!
ArahDrape 2.2 can now work from a command line without any GUI interface. You can also call ArahDrape as a C library. In this way, it can be used in a web server to create texture mapped images on the fly. The command line options are explained below.
ArahDrape 2.2j command line version, ©2015 Arahne
usage:
adCommand -o /tmp/outputImage.png -tN /home/user/texture.png [-hidemodel] [-divide 2] [-filterPNG] [-compressPNG 2] [-m /home/user/model.png] -owner name -activation 174b3cfb49e9 /home/user/project.drape
Input and output images can have png, .tif or .jpg extensions
-o output_image_file
-tN texture_image_file [N goes from 0 to 199]
-hidemodel will render all areas not in region as white
-divide N [N goes from 2 to 5] divide resulting image pixel size
-filterPNG if you do not filter it, rendering is faster
-compressPNG N [N goes from 0 to 9] lower number saves faster, but bigger files
-m model_image_file use this if you want to replace model image from the project; must have same pixel size
-owner owner_name pass the given owner name
-activation activation_code pass the given activation code
last parameter should be ArahDrape project file
All files should be entered with full path.
If you need spaces in filenames, use quotes "" around the filename.
If you provide only Owner name, without activation code, program returns registration code.
ArahDrape supports batch export.
Open ArahDrape project, click on texture you wish to replace, put all your texture in a directory, select from menu
Textures > Browse textures, and as you click the texture to load it, program will save the draped picture. If you have thousands of images, use keyboard shortcut = and program will automatically do them all.
Alpha channel transparency is supported in loading model images or textures, and saving the draped images, as long as you use PNG or TIFF.
Please check this video to see how
ArahDrape works in batch mode.
we (http://digitaldraping.com/) can do just what you are asking. We have two options creating images and rendering a meshed image on the fly. Just get in touch if you still need this solution.

Resources