ImageJ-display pixel value on image - imagej

I have a small image and I want to display each pixel value on the image in ImageJ instead of pointing each pixel and look at the value one by one. Is there any method to do that?

You can use the Image ▶ Transform ▶ Image to Results command.

Related

How to change GIMP print size with script-fu

I am using GIMP 2.10.24. I have some image and I need to change Print Size Width to 21mm and Height to 30mm.
I can do that with Set Image Print Resolution Dialog (Menu->Image->Print Size):
screenshot
But there is my question: how could I do that using script-fu or python-fu?
Print size, size in pixels, and print definition are completely related:
print size = size in pixels ÷ print definition
So to change the image print definition you use
In Python:
pdb.gimp_image_set_resolution(image, xresolution, yresolution)
In Script-fu:
(gimp-image-set-resolution image xresolution yresolution)
In both case the X/Y resolutions are in dots per inch.
However if you are using Gimp just for this creating a Gimp script is overkill (the learning curve is quite steep). If the image is in a common format (JPEG, PNG, TIFF) the print definition is part of the image metadata (JPEG header, or EXIF data) and can be changed directly without decoding/reencoding the image using CLI utilities. For instance with ExifTool:
exiftool ${your_image} -xResolution=321 -yResolution=321

Opencv increases image's size after rotation

I am using opencv in python to rotate an image and the original and the resulted images are differrent is somethings, I am doing my transformation through this part of code:
img = cv2.imread("image.tif")
new_image = cv2.getRotationMatrix2D((cols / 2, rows / 2), correction_angle, 1)
dst = cv2.warpAffine(img, new_image , (cols, rows))
cv2.imwrite("Rotated_image.tif", dst)
The original image's size is 1.7 Mb, The image's resolution is 300
dpi, and the color space is YCbCr.
The issue is that the resulting image with 12.5 Mb size, 96 dpi, the color space is RGB, and with compression "LZW"!
My question is that: Can I keep the main properties of the original image? and why rotating an image changes the size this way?
Note: The bit depth is 24 in both images.
Calling cv2.imread with only the name of the file uses the default value cv.IMREAD_COLOR for the second parameter, about which the documentation says:
If set, always convert image to the 3 channel BGR color image.
So, your image is always converted to RGB. You can try using cv.IMREAD_ANYCOLOR for the second parameter of imread, but I don't think you can use cv2.warpAffine on it trivially then.
The difference in the stored DPI information stems from the fact that you write the new image without any meta data. imwrite allows you to specify parameters (see here), but, unfortunately, they are not very well documented. I am not sure if this kind of data can be written out of the box with OpenCV.

Open *.data files as greyscale images in GIMP

I am trying to open a greyscale image in *.data format in GIMP, but the only options that I get are multichannel (RGB, RGB alpha, etc.). Is there a way to change this? Thanks.
File->Open
Choose Raw image data as the file type and find your .data file and open it.
In the proceeding Load Image From Raw Data dialog, set the Image Type to Indexed. Set the Offset to 0 and the Width and Height to the correct dimensions for your data. Leave everything under the Palette section as defaults.
Open in RGB and change Image > Mode > Greyscale?

Padding in ImageMagick

I am doing a comparison with imagemagick on a project. I have a reference image and test image. I deleted few lines to make changes in test image. This reduced the size of test image. Is there any way that if I could add some white padding at bottom to test image so that while comparing reference image and test image the size of two images remains same.
Please help!
convert -border 5x5 inputimage.png outputimage.png
This command will draw a 5x5 pixel border around your image. Further, you can selectively control at the edges, color and size of the borders drawn on an image. This link will show how to do that.

Is there a way to get coordinates of cropping via Rmagick after cropping?

I have a RubyOnRails application.
I use carrierwave for images uploading and jcrop for cropping.
I have two images: original and cropped image.
But I have no saved coordinates of this cropping (crop_z, crop_y, crop_w and crop_h)
Is there any way to get cropping coordinates via Rmagick or something another solution?
Thanks
In general I don't think the crop coordinates are recorded in the image metadata. (They're saved in the metadata in the Magick format but very few people save their images in that format.) However, you may have some luck detecting the position of the cropped image in the original using the find_similar_region method. Pass the cropped image as the target argument. If this method finds a region in the original that matches the target it returns the x- and y-offset of the region. The width and height of the region, of course, are the width and height of the cropped image.

Resources