I am trying to run GIMP using console commands. All I want it to do is rotate an image 90 degrees. I added GIMP to my environmental variables so that I can call it from a console window. I also put the picture I want to rotate in my root console directory to make it easy to open.
I read the GIMP Batch Mode guide and came up with this command:
gimp-2.10 -i -b '(gimp-image-rotate plot.png 0)' -b '(gimp-quit)'
The "0" after "plot.png" is supposed to tell it to rotate 90 degrees. This opens a GIMP output window and outputs two messages saying "batch command executed successfully". However, it never rotates the image.
Any idea why the command I have entered is not working?
gimp-image-rotate rotates a loaded image and not a file that contains an image. So you have to
obtain an image by loading it from a file (see the gimp-file-load or gimp-file-{type}-load calls),
rotate the image,
save the result (gimp-file-{type}-save (caution: these calls save a layer, not the whole image)).
But for simple manipulations you are better off using a toolbox designed to be called from scripts such as ImageMagick:
magick mogrify -rotate 90 plot.png
Related
I managed to make tiles with ImageMagick like this:
-size 900x900 tile:D:\tile.jpg D:\tiles.jpg
But i want to resize the image before the tiling (300*300px) - and then maybe afterwards apply a sharpen, but the most important is the resizing.
How do i do that in one command line?
Work from a simple command like this...
convert D:\tile.jpg -resize 300x300 -write mpr:tiler +delete ^
-size 900x900 tile:mpr:tiler -sharpen 0x2 D:\tiles.jpg
That starts by reading in your "tile.jpg" image and resizes it to 300x300. Then it writes that resized image to an ImageMagick built-in memory register named "mpr:tiler" and deletes it from the current list. (You can name it "mpr:almost_anything".)
Next the command sets a canvas size of 900x900 and creates a tiled canvas filled with that "mpr:tiler" image.
You can add sharpening and other operations after reading in the input image and before writing it to the memory register, or after creating the tiled image and before writing it to an output file.
The command above is in Windows syntax. To run it in *nix change that continued-line caret "^" to a backslash "\". If you're using ImageMagick v7 replace "convert" with "magick".
Is it possible to create an AHK script that will position a given image (not changing) relative to a different "image" that will be moving constantly on the computer screen? I put the second "image" in quotations because the program would have to constantly search for that "image" or set of pixels that make up that "image" in order to correctly position the first image relative to the second "image".
If it's not possible to do this with AHK, how else can this be done?
The "image" would have to be placed always on top (or above all other programs).
Yes this can be achieved relatively easily.
You will need to create a Loop which performs:
Pixel Search/Image Search
Using the data retrieved from (1), depending on how the image is displayed using AHK, perform a image move function. If you use a borderless window (GUI), you will need WinMove function.
See all commands here: Commands
I am attempting to make a very simple label using Libreoffice Draw v 4.0.2.2. The label has not much more to it than regularly spaced lines of centered text
This image will be printed, and I have a fixed size/ppi requirement to ensure appropriate print quality.
I set the page size to my specs, and layout the text as I desire. The print shop takes several image formats including .tiff and .png. When I export the image, a dialog pops up that asks for the image size/ resolution. The given ppi is very low (~40) and I require a minimum of 180ppi. When I enter this, the image size adjusts itself and results in an image that is far too small.
The only solution that appears to be viable is to explode the page size and the drawing text size so it gets shrunk upon export. This is a very imprecise and illogical feature (bug?) of the program that I really wish is a result of my ignorance.
I found a thread in the mailing list which describes this issue exactly. The only answer that is given is essentially "yes, this is ridiculous and doesn't help anybody".
Can anyone give some advice to this? Or at least shed some light on who might need this "feature"?
There is something off about the Export tool of LibreOffice in general. It has been years since it is broken. Taking a screenshot is an alternative, but obviously you cannot control the resolution.
So, a better work around is exporting to SVG, and then convert the SVG to PNG with Inkscape. Once downloaded, convert the file with the following command:
inkscape -z -e out.png -w 1024 in.svg
If you are in Windows (x64), you will need to indicate the full path:
"C:/Program Files/Inkscape/inkscape.exe" -z -e out.png -w 1024 in.svg
If you install the 32 bit version, this should work:
"C:\Program Files (x86)/Inkscape/inkscape.exe" -z -e out.png -w 1024 in.svg
This can be done from inside Libre Office, there is no need to use any external tool. The Export dialog is very confusing, yes; you have to realize that both size and resolution can be set independently.
Select File -> Export -> choose the desired format. The export dialog should appear.
TAKE NOTE of Width and Height. Set the desired resolution; notice how Width and Height change (?). Don't worry, restore Width and Height to your saved values. And that's it. You get a high resolution image with the desired size and DPI.
Libre Draw (the one I'm using anyway) is a vector drawing app - have you asked the print shop if they can use vector formats like eps, pdf? Most should be able to in my experience. Then resolution becomes irrelevant.
-Terry
I have a simple code to show an image in Matlab. I use imread() to read it and imshow() to show it. the code it below, and the result in not shown properly. hope someone can help me.
img = imread('/home/samuelpedro/Desktop/API - Projecto/coimbra_aerea.jpg');
figure, imshow(img);
the resulting image is below.
also, if i choose to save it to file as a new jpg it is saved correctly.
UPDATE 1:
weirdly if i choose to show the axes in the preferences>image processing, it is corrected
Locking at your screen-shot, the x- and y-ticks are missing. They should appear in a standard-configuration of Matlab. Maybe something is just messed up in the Matlab-configuration. Try to do this with a clean new ~/.matlab folder (rename the old one before).
Alternatively ... again judging by your screen-shot, this looks like Ubuntu/Unity in the background. Unity needs acceleration (OpenGL), which can be randomly buggy for some Linux graphics drivers. You may want to try to launch matlab in a "clean" X-server (maybe the twm environment) to rule this out.
Save the image as an (uncompressed) bitmap (bmp) and read it with imread. If the jpg is messed up by the imread-routine, this should rule this out.
Last but not least, broken copy of your jpg on your disk, some flipped bits. Run md5sums on your file's copies.
When running MATLAB in a batch mode without a display (e.g. with the $DISPLAY UNIX environment variable unset, or with the matlab -nodisplay flag at startup), normally you cannot use the opengl renderer. Instead you must settle for the painters renderer. For example:
>> print -dpng -opengl fig.png
Warning: OpenGL mode can not be used in terminal emulation mode; ignoring option.
Unfortunately, painters often gives poor results when working with 3D scenes with patches, lighting, transparency, etc.. Here is one simple example (using a display for now) where the alpha is lost:
peaks
alpha(0.5)
print -dpng -opengl peaks_opengl.png
print -dpng -painters peaks_painters.png
Because of these limitations, I was very excited to find the mostly-undocumented hardcopy() built-in MATLAB function, which does somehow let you use the opengl renderer without a display. This function underlies the terrific export_fig() function. Now I am able to very rapidly save high quality 3D figures in batch mode.
However, there is one catch: All text is lost when the figure gets passed through the hardcopy() function. For example:
plot(1,1)
title('TEST')
>> A = hardcopy(gcf, '-Dopengl', '-r300');
Warning: Failed to draw text string
> In /Applications/MATLAB_R2010b.app/toolbox/matlab/graphics/hardcopy.p>hardcopy at 21
The output figure is completely lacking any text (no axis ticks labels and no title):
export_fig axis.png -opengl
So what I'm wondering is: How can I get the opengl renderer to work with text in batch mode? Is there a way I can get text to work with the hardcopy() function? Perhaps a way to rasterize the text beforehand? Or a way to combine a painters hardcopy of the text and an opengl hardcopy of the plot? Alternatively, is there a completely different route to make this work than the hardcopy() function? Also note that the problem is unlikely to be with my system setup, since it is reproducible under both Mac OS and Ubuntu.
If you're using Linux, you can use a software OpenGL renderer (modern versions of Matlab have one bundled).
Such an option does not exist for Mac OS, at least not with current Matlab versions.
Windows is easy - even the batch mode runs a display, so you can work as usual.
Run Xvfb :1 &, which creates a (virtual) framebuffer X server.
Prepare your code in some file, say bla.m :
opengl software;
peaks
alpha(0.5);
print -dpng -opengl peaks_opengl.png
exit
It's very important not to forget opengl software, as you imagine.
Run the following command:
cat bla.m | matlab -display :1 -logfile log.txt
which makes Matlab execute whatever's in bla.m, on the virtual display, and writes whatever Matlab outputs into log.txt. You can drop the logfile when everything seems to be working. Also, note that :display :1 has to fit the number you provided in the Xvfb invocation.
Profit.