scilab - Writing multiple images to a single folder - image-processing

I am working in Scilab 5.5.2. I need to write multiple images to a single folder. The images which I want to write are cropped images from a set of inputs. I am able to write a single image to the folder with the following command:
imwrite(fname,strcat('C:\Users\dell\Desktop\example_sci\myfolder\1.jpg'));
I have put this in a for loop, so the output image is over written and the result is a single image.
How can i write all the results to a single folder?

You should create the paths like this.
for j=1:10
pathname = "C:\Users\dell\Desktop\example_sci\myfolder\"+ string(j) + ".jpg"
xs2jpg(gcf(), pathname);
end
I usually use the xs2*-command to export a chosen figure. (I use scilab 5.5.0, which does not contain imwrite anymore.)

Related

Edit Photos via Photoshop on a server

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

LibTiff.net - Save Directory

I have massive tiff file that contains 8 directories (resolutions). It's also a tiled.
I can cycle thru the directories and get the resolution of each. I want to save the 4th directory to a new tif file. I think it's possible but can't get my hands on it.
Basically want to do this:
using (LibTiff.Classic.Tiff image = LibTiff.Classic.Tiff.Open(file, "r"))
{
if (image.NumberOfDirectories() > 4) {
image.SetDirectory(4);
image.WriteDirectory("C:\\Temp\Test.tif");
}
}
It would be so nice if that was possible but I know I have to create an output image and copy the rows of data into it. Not sure how yet. Any help would be much appreciated.
There are no built-in methods in LibTiff.Net library that can be used to copy one directory into a new file.
The task is quite complex and the best place to start is to look at TiffCP utility's source code.
The utility no only can copy images but it can also extract directories.

ImageMagick: Convert selective images to Multipage PDF without using external text file?

Let's say I have a directory with 5 TIFF files in it and I want to convert some of them to a multipage PDF, but that there are other TIFS in the same directory that I do not want in the same PDF.
In other words, I want to convert file1.TIF, file2.TIF, file3.TIF --> foo.pdf, but I want to ignore file4.TIF and file5.TIF located in the same folder.
It would seem from the documentation that the only way to do this is to provide ImageMagick with a text file listing out the files and then point to it when calling the program, as in:
convert #FilesToConvert.txt C:\foo3.pdf
Is there no way to make the call inline though, so that I don't have to create a separate text file for each conversion?
Thanks in advance!
You should be able to use:
convert file1.TIF file2.TIF file3.TIF foo.pdf

How to edit eval.lua script in NeuralTalk2 to process a single image?

I want to modify the script eval.lua provided in NeuralTalk2 code.
The script works with a given images' path.
I wish edit it in order to call this script giving just a single image path instead of the path of a directory containing several images.
Thanks in advance!

How to change the default image viewer in SimpleITK

I am using the SImpleITK and ipython notebook for image processing and as we know imagej is the default image viewer in simpleitk. But the type of image i am using is .mha and .mha is not supported by imagej. For this I have to use fiji or imagej2.
I have tried to make fiji as a default image viewer according to the instruction mentioned in simpleitk FAQs but did not get success and show the following message:
I want to know what mistake I am doing .
How to make Fiji or imagej2 as a default image viewer for all types of images when I work with simpleitk and ipython notebook.
Thanks.
Looks to me like you still have ImageJ in your STIK_SHOW_COMMAND variable which is not found in your fiji folder.
Read the instructions again. I assume you did not follow them well enough. Your variable should contain the new image viewer and no ImageJ in a different folder.
Try to change the extension of the file with the system variable SITK_SHOW_EXTENSION and try to provide the command to the visualisation software with SITK_SHOW_COMMAND.
In my .bash_profile I have:
export SITK_SHOW_COMMAND='itksnap'
Other instructions can be obtained with ?sitk.Show() .
Try changing the "%F" to "%f". It is case sensitive. Or actually, you can just leave it off. If there is no "%f" it will just put the file name at the end of the command line.
Also, you can use SimpleITK/ImageJ to view MHA files. SimpleITK actually writes out a Nifti file by default when Show is called, regardless of the input image.

Resources