Edit Photos via Photoshop on a server - image-processing

I wart to create a web app where a user enters certain data via a form and then receives a custom rendered image. The image is from a smart object in a psd. It's kind of like a mock-up which definitely requires needs some photoshop filters to be properly rendered.
This should all happen in real time and should be doable from my understanding since the rendering of a single images doesn't need much computing power
I've done some research and haven't really found a solution the matches my problem. Is it necessary to run Photoshop on a server and then remotely run a photoshop script and then upload the generated image somewhere else?
I've used The After Effects Plugin Template by DataClay in the past which offers similar functionality but for video.
Looking forward to hearing your ideas.
Thanks

You can use the Dataclay plugin to handle still image exports out of After Effects. Make a single-frame duration composition in After Effects and rig the layers with the Templater plugin. Then use the PNG Sequence output module to render out a single frame.
From Dataclay's forums:
Exporting
A few extra steps are required to correctly render a project file as a PNG sequence using Templater. By default, a file rendered as a PNG sequence will have the frame number appended to the end of the file name, i.e.:
filename.png00000, filename.png00001, filename.png00002, etc.
In order to designate where in the filename the frame number should be added, we’ll need to use the output column. First, add a column named output to your data source. Next, add a filename with a set of brackets with five # signs to designate where the frame numbering should be added. For example:
filename[#####] would result in filename00001.png
or
[#####]filename would result in 00001filename.png

Related

Mediapipe custom calculator for loading an image

I have a mediapipe workflow containing a video stream input from webcam. I woudl like to load an additional single constant image into the pipeline and load this image as gpubuffer(once), so that a new calcucaltor node(default mediapipe) can take the current video frame(gpubuffer) and the constant image as its inputs.
What would be the ideal way to accomplish this task so that we could keep the cpu-gpu memory copy to minimum. Should we create a custom side packet calculator to load the image or should we create another input stream to the pipeline? Also there seems to be a operator called 'OpenCvEncodedImageToImageFrameCalculator'; but it takes a raw string as its input.
In the following link solves the problem to an extend; but it seems to involves lot of cpu-gpu memory copies and some extra processing steps.
Ref: https://towardsdatascience.com/custom-calculators-in-mediapipe-5a245901d595
Github: https://github.com/google/mediapipe/issues/1123

saving roi in imageJ without prompt window

When I try to save a roi in imagej using the code below, a window prompts to save the roi. However, I want to save the roi programmatically so that I can do it for several different files. How can I avoid the prompt window and how can give each roi a specific name (the whole file is saved with the name RoiSet which contain several roi that each should have a different name I choose)?
rm.runCommand("Save", IJ.getDirectory(r"path to my folder") + "RoiSet.zip")
The issue is that IJ.getDirectory(String) returns null, so your path becomes nullRoiSet.zip, which ImageJ thinks is not a valid path, and therefore it prompts with a dialog box.
You do not need the IJ.getDirectory call here; just pass r"path to my folder\RoiSet.zip" directly and it should work without popping any dialogs.
It looks like you are not using the macro language, which might make things a tad more difficult, but I'm not an expert by any means, so take that assumption with a grain of salt. If you do decide to switch and use the macro language, you can simply wrap your code in the batch mode function like so:
setBatchMode(true);
example code here;
setBatchMode(false);
As for saving, the macro language uses the saveAs() function, which takes file type and save path + title of the file as arguments. If you want more info about, or help writing in, the macro language, let me know and we can likely put something together rather quickly.

How to include a photo in Moderncv Casual

Well, to start with, I don't know much about Latex. I am failing to include a picture in to the document using "Moderncv Casual". A lot of the CV's and cover letter's template using:
\photo[64pt][0.4pt]{filename}
What's the deal with this? Is it not just to type the pictures's filename, compile, and the picture should be added to the document?
That's exactly it. The \photo macro is set up in such a way that it stores your input and makes it part of the CV title (set with \makecvtitle).
The reasoning behind this is to provide the end-user with a generic command to would capture a picture. However, depending on the template used, this picture may appear on the left/right/middle (or wherever). The generic input abstracts this placement from the rest of the code.
Specific to the command \photo; it is defined inside the class moderncv.cls file as:
\NewDocumentCommand{\photo}{O{64pt}O{0.4pt}m}
{\def\#photowidth{#1}\def\#photoframewidth{#2}\def\#photo{#3}}
An input like
\photo[64pt][0.4pt]{filename}
defines the photo to be kept in \#photo - it references the image file filename (with an image extension) - to have a width of 64pt (stored in \#photowidth) and frame width 0.4pt (stored in \#photoframewidth).

Alter DICOM tags without saving

I'm using EvilDicom to grab DICOM data from my DB and transfer it out to a directory where it can be used another program. The secondary program checks in for new files periodically but I need to change a DICOM tag before it does.
I could have a temp location, change my tag, then resave it but I would rather change it while it is in memory and write it directly where it needs to go. I can't seem to figure out how to do that within the EvilDicom API.
Any suggestions?
(Following the basic code in "EvilDICOM in ESAPI" youtube video)
Take a look at the FileWriterSCP class. Just change the DIMSEService.CStorePayloadAction action which gives you the DICOM file in memory.
DIMSEService.CStorePayloadAction = (dcm, asc) =>
{
//DO STUFF WITH dcm variable HERE
}
The cleanest way is to not manipulate in memory because you rely on EvilDICOM's SCP to be robust, and since I made it, I can tell you its just "pretty good" ;) I would use a DICOM SCP like Varian's FileDaemon to catch and write files and then change them once they are on the hard-drive.

How to show Photoshop Action in Forum; save, decrypt, convert .atn file to text?

Briefly, I would like to show a moderately complicated Photoshop action in a forum. Saving the .atn file is easy, but it is encrypted by adobe.
I found a 25,475 line .jsx file which will apparently convert it to XML but is unusable without any usage or documentation
http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/apps/ActionFileToXML.jsx
What is the easiest way, other than read action word, type word in text editor, to get the 6 inches of action (as seen in Photoshop) into plain text?
GORY DETAILS:
I have a large number of files which I inadvertently damaged by using perfectlyclear on them. It enhances some of the areas but pathologically destroys all darkish areas by converting them to pure black and near zero contrast. When printed, the pictures look like somebody took a black magic marker and redacted large areas. They are damaged beyond use as-is.
The Photoshop fix is to
duplicate layer
select color range, click on a black area, set fuzziness to ~12, range=100%
select expand 4, feather 3
make new mask channel
select backward (original) layer
delete (nukes blackened area under mask)
save as PNG with transparency
This leaves a PNG file with the redacted areas transparent and with feathering around them. By placing the original file beneath it, the original non-blackeded areas are shown.
I would like to document this modest solution in an ImageMagick forum but can not believe how far adobe has gone to lock my action into adobe-only tools. I want to jailbreak this and all of my other actions.
NOTE: There is a one line usage in ActionFileToXML.jsx: "This script reads an ActionFile and converts it to XML" and no documentation of any type. An alert I stumbled upon states that it will only work in CS2/3/4 and I have CS6. It has a 2007 date on it.
I have read that this .JSX is adobe's version of JavaScript and that you run them from inside Illustrator (which I don't have).
I want to figure out how to decrypt my actions and write a useable script:
USAGE: decrypt.atn.to.txt.pl encrypted.atn [-o text_file_name] <enter>
Supply fully qualified path to a .atn" file and it will be deciphered
into a useable .txt file with the same path/basename and a .txt
extension unless you use the -O option which will attempt to write to
the file name you supply.
Perhaps, I could even make a CPAN module?!
Good thing the .JSX writer had the foresight to include 0.0039% documentation or the program would be completely useless! :)
SOLUTION == and STEP by STEP instructions:
The link:
http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/apps/ActionFileToXML.jsx
points to a gigantic adope extend-script. Reading the file, line 3 has the ~only documentation:
// This script reads an ActionFile and converts it to XML.
The filename already tells you this: ActionFileToXML.jsx
Without wading through 25,000 lines of largely uncommented, 8-year-old code/data/??? it is completely unusable.
What the link poster failed to include was the PACKAGE containing the other 300 files which includes the README.txt, INSTALLATION.txt, /docs, etc.
The PACKAGE supplying context, install, usage, etc can be found at
http://sourceforge.net/projects/ps-scripts/files/xtools/v2.2betas/
How to Decrypt adope's .atn file, step by step:
download README.txt and xtools*.zip from http :// sourceforge.net|projects|ps-scripts|files|xtools|v2.2betas
READ README.txt and unzip zip to any place you like (and REMEMBER where you put it). NOTE: evilnet explorer will by default hide it under some mile long, incredibly ugly file path where you may never find it so use FIREFOX: set tools -> options -> general -> downloads to Always_Ask_Me (or set a reasonable download directory)
Photoshop -> actions, click on action set you want to decipher and click the "arrow box" to the right of actions -> save_actions and put them where you can find them
Photoshop file -> scripts -> browse and navigate to where you stashed ActionFileToXML.jsx and execute. This pops up a GUI as shown at http :// ps-scripts.sourceforge.net|xtools.html
Navigate to where you hid you .atn file, the XML file box will be populated with the same path/file_BASE_name and an XML extension as a default. Adjust name/location to suit
hit PROCESS and in a delightfully brief period (in my case), it was done
Get ready to marvel at the succinct efficiency with which adope stores an action like [select->color_range, localized, fuzziness=14, range=100%] (56 bytes written by hand) in only 3635 bytes of unfathomably labyrinthine XML with no default values left underspecified. It look a lot like IRS regulation fine print! ;)
The main difficulty in trying to make sense of the XML is that it is written in some funky interpreter psycho-code which bears absolutely no resemblance to the keys/clicks you actually used to create it.
One of the steps I was attempting to elucidate was was simply layer (I NEVER ToucheDER) -> layer_mask -> hide_selection. It is diabolically obfuscated as (and I quote):
<ActionItem key="TEXT" expanded="false" enabled="true" withDialog="false" dialogOptions="2" identifier="TEXT" event="make" name="Make" hasDescriptor="true"><ActionDescriptor key="make" count="3"> <DescValueType.CLASSTYPE key="1316429856" id="1316429856" symname="New" sym="Nw " classString="Channel" class="Chnl"/><DescValueType.REFERENCETYPE key="1098129440" id="1098129440" symname="At" sym="At "><ActionReference key="1098129440" id="1098129440" symname="At" sym="At " count="1">
make .. new .. channel .. at .. mask .. hideSelection? Huh?
I had to scratch my head and fiddle around with the Channels panel options before I found the menu solution.
According to the generous and personable developer, Xbytor (who patiently answers emails from agitated would-be users), this XML can be hacked (carefully), translated back into a .ATN file and used by Photoshop. A very powerful possibility.
Brian

Resources