Adobe Photoshop 'Save As' Action - action

I'm trying to save a large number of images in JPEG format. Each file combines 2 layers visible on the screen. To achieve this, I've recorded a simple action that saves the file as X.jpg. I don't mind the fact that it saves the next file as X copy.jpg, but the problem occurs when trying to save the 3rd image (and other consecutive images), as instead of creating another file, it replaces the previous X copy.jpg file with the 3rd image.
Does anyone know how to instruct it to keep creating new files instead of rewriting the X copy one?

Related

Is there a way to copy Google Earth place names as text?

I'm new to python and doing a work project that involves juggling a lot (5-10k) of "places" (polygons representing regions) in google earth. As such, I wanted to run a list compare between the places I have in google earth against a txt file list of places I should have. The only problem is that I cannot seem to find a way to copy paste or otherwise capture the name text of the google earth places. Copying with control c or right click copy copies them as a KMZ file, or when pasted into a text editor gives the full source from their "properties" tab. I'm fairly confident in manipulating and comparing the lists once I have the data in that format, but could really use some help in attaining it as such.
First right-click on saved places in Google Earth and save as KML (text) file.
Next, you can use Python to extract the place names from the KML file.
Here's some sample code using pykml module to parse out the place names.
from pykml import parser
with open('places.kml') as f:
root = parser.parse(f).getroot()
# iterate over each placemark
for pm in root.Document.Placemark:
name = pm.name.text
print(name)

How to save compressed pixels (compressed with my own encoder) back into DICOM image file using Imebra library?

I have my own image encoder and decoder. What I want is to read DICOM images, extract uncompressed image pixels, compress them using my encoder and then write those compressed pixels back in the DICOM file in place of uncompressed pixels. Decoder would do the opposite. Is this possible to do in Imebra? I can read tags and pixels, but after I compress them, I'm not sure how to put them back (they are currently in char* buffer), or if this is even possible. I'm using Imebra in C++.
Alternatively, it would be okay if I could create completely new DICOM file, but in that case I would need to easily transfer all the DICOM tags from the old file.
If this is not possible in Imebra, is there some other C++ library that allows this?
Edit:
Thanks for the answer, Paolo. However, original DICOM image still remains unchanged (using second option). Can you say am I doing something obviously wrong here?
std::unique_ptr<imebra::DataSet> loadedDataSet(imebra::CodecFactory::load(imgNameM));
imebra::WritingDataHandlerNumeric* dataHandler = loadedDataSet->getWritingDataHandlerRaw(imebra::TagId(imebra::tagId_t::PixelData_7FE0_0010), 0);
dataHandler->assign(buffer, size);
delete dataHandler;
loadedDataSet is not empty, I checked with bufferExists.
Edit 2:
Yes, I didn't save it. Now I added that line and managed to modify PixelData element which was solves my original problem. Thanks. However, some other parts of the file are now automatically also changed. More than 100 empty bytes are added at the beginning of the file, although this doesn't bother me that much. What bothers me is that (0008,0005) Specific Character Set tag is now added and its value isn't set (it's empty) which then causes CharsetConversionNoTableError when trying to read tags of that modified file. If I remove that tag manually and fix the group length, I can read tags normally. Is there a possibility to avoid this behavior?
Imebra already provides the encoder/decoder for lossless jpeg, baseline and extended jpeg, RLE.
There are several ways of adding your own codec to Imebra:
derive a class from imebra::implementation::codecs::imageCodec
or encode an image into a char buffer, then add it as raw content using imebra::DataSet::getWritingDataHandlerRaw which allows you to write the tag raw content. getWritingDataHandlerRaw returns a WritingDataHandlerNumeric. Use WritingDataHandlerNumeric::assign to move the bytes buffer into the data handler, then delete the data handler to cause it to commit its content into the dataset.
The example changeTransferSyntax that comes with the library shows how to create a new dataset with all the same tags from the source dataset but with a different transfer syntax (including a different image compression)

How to edit text file data with c++

I have a program that create a text file of stock items, which contains detail of 'total production' , 'stock remaining' and so on. Now my question is how do I edit that text file with my program. For example if I mistake to enter a correct data (like production was 500 pieces but enter only 400) now how can I edit my file to make it correct without effecting other data.
You probably should not create a text file in the first place. Did you consider using sqlite (or indexed files à la GDBM ...) or some real database like PostgreSQL or MongoDb?
If you insist on editing programmatically a textual file, the only way is to process every line : either keep all of them in memory, or copy them (except the one you'll change) to some new file.... But there is no portable way to change the content of a file in the middle.
You might also be interested in textual serialization formats like JSON, YAML (or maybe even XML).

When using SimpleCV with GeoTiffs what is the best way to keep the georeferencing data?

I have searched the internet at depth looking for help on this. I have two images (before and after) that are georeferened and georectifyed to be right on top of one another. I am using Simple CV hopefully for some indepth analysis and changed between the image. Right now I am just getting familiar with Simple CV and am using the blob detection. Here is my code:
from SimpleCV.base import *
from SimpleCV.Features import *
from SimpleCV.ImageClass import *
from SimpleCV.Display import *
var1 = Image("C:\Users\pathname\image.tif")
var1.show()
blobs = var1.findBlobs()
blobs[-1].draw() #The blobs[-1] fills in the blob
var1.show()
var1.save("C:\pathname\Blobfill1.tif")
I do the the blob detection on the before and after image and save them both as tifs. However when I begin to subtract to the images or even bring both images back into ArcMap, they have have lost all their spatial reference data and no long right on top of one another. It is very important that the two images stay exactly right on top of one another during my analysis period. Appreciate any help!
It appears to me that SimpleCV is simply not saving the exif data in the image file. I doubt it is reading it at all when you are loading the file.
The easiest way may be to open the file as you have use something like pyexiv2 (http://tilloy.net/dev/pyexiv2/) to read the exif information including the georeferencing.
When finished save as you have and use pyexiu2 to save the georeferencing back to the saved file.

Can't get the same CRS for different layers in QGIS

I have just begun to fiddle around with QGIS. Now, I have a .shp file containing a map of Sweden. I want to add a vector point to that map by adding a new point layer through the Delimited Text File plugin. The CSV file that I'm importing contains the following data:
id,lat,long
1,62.30000,14.10000
The dot appears on the screen but very far away from the country map. I assumed that was because the layers were set to different CRS, but after right-clicking each layer and changing the CRS to WGS 84, nothing changes. What am I doing wrong here?
EDIT: Just go it to work by deleting the point layer, changing the coordinates in the CSV file to SWEREF99 TM, and importing the layer anew with the same plugin. But I'm still wondering if it's not possible to change the CRS after importing?
You can always change a layer's CRS by overriding the setting in layer properties - General tab. Note that the features are not reprojected when you change this setting. You are just telling QGIS to interpret the coordinates differently.