Simple Java Image Tool
Contents:
- General
- Read a single image file
-in
- Write/Convert an image file
-out
- Files with multiple image frames
- Modify image
- Transfer colors
-color
- Make a color transparent
-color
- Remove alpha channel
-removeAlpha
- Change hue/saturation/brightness/contrast
-addHue/-addSat/-addBright/-addContrast
- Change red/green/blue/alpha
-addR/-addG/-addB/-addA
- Resize image
-resize
- Cut image
-cutLeft/-cutRight/...
- Invert image
-invert
- Make image grayscale
-makeGrayscale
- Rotate image
-rotate
- Mirror image
-mirrorH/-mirrorV
- Split image
-splitH/-splitV
- Change JPG quality
-jpgQuality
- Transfer colors
- Combine images
- EXIF functions
- Process multiple files (batch)
- Create new images
- Troubleshooting
- License
General
java -jar SJIT.jar -?
The program expects command line arguments as described in this webpage. The basic principle is that with
-in
the input image file is specified. Based on this the program will print information about this image and it can be modified
using other arguments.SJIT can read and write various image formats:
Read | Write (convert) | |
---|---|---|
Bitmap (.bmp) | ✔ | ✔ |
JPEG (.jpg|.jpeg) | ✔ | ✔ (changing EXIF metadata / compression level) |
PNG (.png) | ✔ | ✔ |
GIF (.gif) | ✔ (multiple frames) | ✔ (multiple frames → GIF-Animation) |
TIF (.tif|.tiff) | ✔ (multiple frames) | |
Icon (.ico) | ✔ | |
Wireless-Bitmap (.wbmp) | ✔ | |
Portable Maps (.pnm|.pbm|.pgm|.ppm) | ✔ | |
Scalable Vector (.svg) | ✔ | |
Photoshop Document (.psd) | ✔ |
Read a single image file
-in [file]
where [file] is the path (absolute or relative) to the input image.
If [file] is a pattern or a directory then all image files which match the pattern or are in this directory
will be processed (see chapter Process multiple files).If no other arguments are given, information about the image will be displayed and the program exits without changes on this image.
The input [x] can also be a web URL (starting with http: or https:). In this case the program will attempt to download the web document and then proceed as normal with the downloaded file. There is a parameter
-removeInput
if you wish
to remove the downloaded file after processing.Example: reading a JPG file 'vsd.jpg' (which is located next to SJIT.jar)
java -jar SJIT.jar -in vsd.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 no -out file specified ------------------------------------------------------- 1/1 processed 1 image(s) in 1700 millisecond(s) total input size: 22 KB total output size: 0 B (=0%) |
Print a certain color value:
With the argument-pos [x,y]
the cursor can positioned on a certain pixel
at column x, row y. If x and/or y are negative then the value will be subtracted from width/height
(for example: -50,-20 → 50 pixels from the right site and 20 from the bottom).Please note: the counting starts with 0 (so first pixel at the top left corner is at 0,0)!
Example: printing pixel at 50,10 (column 50, row 10)
The color value is printed in different color space models:
java -jar SJIT.jar -in vsd.jpg -pos 50,10
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 print pixel value ... [50|10]: 0x57b3fe RGB: R=87,G=179,B=254 HSB: H=0.5748503,S=0.6574803,B=0.99607843 HSL: H=206.94612,S=0.9881657,L=0.66862744 HSV: H=206.94612,S=0.65748036,V=0.99607843 CMYK: C=0.6574803,M=0.29527557,Y=0.0,K=0.0039215684 YPbPr: Y=0.6276157,Pb=0.20793614,Pr=-0.20430747 YCbCr: Y=153.44783,Cb=174.57773,Cr=82.23509 YUV: Y=0.6276157,U=0.18132468,V=-0.25128818 no -out file specified ------------------------------------------------------- 1/1 processed 1 image(s) in 475 millisecond(s) total input size: 22 KB total output size: 0 B (=0%) |
- (A)RGB: (Alpha,) Red, Green, Blue in the range 0-255. This is the default color model in IT systems. If the input image contains no Alpha channel (non-transparent images, TYPE_3BYTE_BGR which is the default for JPG) then no Alpha value is printed (you could assume all Alpha is 255). If the image has an Alpha component (possibly transparent, TYPE_4BYTE_ABGR, the default for PNG) then it will be printed. Please note: Alpha 255 means non-transparent where Alpha 0 means fully transparent (then other color values dont matter).
- HSB: Hue, Saturation, Brightness in the range 0.0-1.0: a more human way of interpreting colors. Please note: in terms of brightness this color model is not the best approach.
- HSL: Hue, Saturation, Lightness. Hue in the range 0.0-360.0 and Saturation,Lightness in the range 0.0-1.0: In my opinion the most suitable color model for changing saturation/lightness because adding lightness in fact makes the image brighter without changing the hue. This color model is used for modifying hue/saturation/brightness
- HSV: Hue, Saturation, Value. The same as HSB but hue in the range 0.0-360.0.
- CMYK: Cyan, Magenta, Yellow and Black in the range 0.0-360.0. This is a subtractive color model used by printers.
- YPbPr/YCbCr/YUV: Color models with Luma (lightness) and Chroma (blue difference and red difference) components used by photo and video applications.
Scan QR codes/barcodes:
With the argument-readQr
the program can scan the image for QR codes/barcodes
and print the content of the codes (using the zxing library).Please note: the library sometimes has difficulties to detect the code if the code is not positioned at the
top left corner of the image. In this case the
-pos
option can be used to place the cursor
where the QR code/barcode area begins.The following barcode types can be read by zxing:
|
Example: read QR code where the code fills the entire image (no cursor positioning needed)
java -jar SJIT.jar -in qr.png -readQr
processing image file: qr.png file size: 508 B select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 100x100read QR code/barcode ... ok (format:QR_CODE size:440bits) code message: The quick brown fox jumps over the lazy dogno -out file specified ------------------------------------------------------- 1/1 processed 1 image(s) in 142 millisecond(s) total input size: 508 B total output size: 0 B (=0%) |
Example: read barcode where the code image is somewhere at the bottom (cursor positioning needed at height 130px)
java -jar SJIT.jar -in arh_barcode.jpg -readQr -pos 0,130
processing image file: arh_barcode.jpg file size: 14 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x150 print pixel value ... [0|130]:0xfffffffd,a=255,r=255,g=255,b=253read QR code/barcode ... ok (format:UPC_A size:0bits) code message: 705632441947no -out file specified ------------------------------------------------------- 1/1 processed 1 image(s) in 280 millisecond(s) total input size: 14 KB total output size: 0 B (=0%) |
Detect/count spots:
With the-countSpots [x]
command all occurrences of the color [x] can be counted and highlighted.
On natural photographs it makes sense to specifiy a tolerance in which color values will still be considered a match.
The option
-tolerance [x]%
allows for setting
such a tolerance where [x] is a percentage value (0-100) which relates to the difference of two color values. The difference of two color values is calculated as √(r1-r2)²+(g1-g2)²+(b1-b2)².
So the maximum (hence tolerance 100%) color difference possible (between black and white) is: √(255-0)²+(255-0)²+(255-0)²=441.67 .
Please note: the tolerance value must be choosed wisely. Too low tolerance can result in not detecting spots. Too high tolerance will likely find too many occurrences (overperforming).
The option -fillColor [x]
can be used to change the highlight color used for drawing the circles in the output image.
Example: count all occurrences of color #362E2C with a tolerance of 6% (≙ 26.5 color difference) and hightlight all spots with red in the output image 'klingel_spots.png'
java -jar SJIT.jar -in klingel.jpg -countSpots #362E2C -fillColor red -tolerance 6% -out klingel_spots.png
input file: C:\Users\A352091\Desktop\Eclipse\workspace\SJIT\klingel.jpg processing image file: klingel.jpg file size: 61 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 421x227scan for spots of color #362e2c ... [1] start crawling at java.awt.Point[x=10,y=0] ... [648] start crawling at java.awt.Point[x=399,y=226] found total of 648 spotsmark spots in image ... ok output file: klingel_spots.png output type is: png cannot use the metadata: TiffOutputSet does not match output type png! create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (klingel_spots.png) output file size: 218 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 1 second(s)total input size: 61 KB total output size: 218 KB (=357%) | |
Please note: it makes sense to write the output image as PNG even though the input is a JPG. This is because PNG is lossless and the highlight lines are much clearer in PNG.
On natural images it is likely that the image contains further occurrences of the color value but they should not be accounted. Therefore the options
-minWidth/-maxWidth/-minHeight/-maxHeight [x]px
can be used to give limits for the spots so they be counted a match only if the conditions apply.
Example: count all occurrences of color #362E2C with a tolerance of 6% (≙ 26.5 color difference) and hightlight all spots with green in the output image 'klingel_spots_withLimits.png'. Only count and highlight spots with width 5px-12px and height 5px-12px.
To make the java -jar SJIT.jar -in klingel.jpg -countSpots #362E2C -fillColor green -out klingel_spots_withLimits.png -tolerance 6% -minWidth 5px -minHeight 5px -maxWidth 12px -maxHeight 12px
input file: C:\Users\A352091\Desktop\Eclipse\workspace\SJIT\klingel.jpg processing image file: klingel.jpg file size: 61 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 421x227scan for spots of color #362e2c ... [1] start crawling at java.awt.Point[x=10,y=0] [648] start crawling at java.awt.Point[x=399,y=226] found total of 648 spots check conditions ... ok (removed 362) found total of 286 spots that pass conditionsmark spots in image ... ok output file: klingel_spots_withLimits.png output type is: png cannot use the metadata: TiffOutputSet does not match output type png! create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (klingel_spots_withLimits.png) output file size: 220 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 2 second(s)total input size: 61 KB total output size: 220 KB (=360%) | |
-countSpots
function work as good as possible on a specific input image it might be neccessary to try out different combinations
of color and tolerance values until the combination is found that produced the best result without overperforming and without missing too many spots. It might be wise to rather
choose a higher tolerance (which might detect too many spots) and then limit the result by use of -minWidth/-maxWidth/-minHeight/-maxHeight
.
Please note: the detection algorithm is designed for rather small spots. If the image contains very large areas of spots which match the detection
this can cause a Stackoverflow (due to recursion). In such cases the input image should be resized so the detection algorithm can handle it with lower effort.
Write/Convert an image file
-out [file]
to write (convert) the currently read image into an output file.
[file] can be an absolute or relative path where the file extension determines what image type to write.
-out output.jpg
writes a JPG file, -out output.png
writes a PNG file and so on.
If [file] denotes a directory then the output file will be written there using the same file name and same file type as the input file.
[file] may also be a pattern using the wildcards {name} and/or {date} where {name} is the file name (without extension) of the input file and {date} is the EXIF field "Date Time Original" (DATE_TIME_ORIGINAL). Those patterns make especially sense if multiple input files are processed.
Please note: when converting from one image type into another information (e.g. meta data) might drop because the new file type does not support it.
Example: converting our JPG file into a PNG image
java -jar SJIT.jar -in vsd.jpg -out vsd.png
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImag... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 output file: vsd.png output type is: png cannot use the metadata: TiffOutputSet does not match output type png! create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (vsd.png) output file size: 112 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 571 millisecond(s) total input size: 22 KB total output size: 112 KB (=494%) |
Example: converting our JPG image into a BMP image using the placeholders {name} and {date}
java -jar SJIT.jar -in vsd.jpg -out new_folder\{name}_{date}.bmp
vsd_2015-08-01_22-22-45.bmp | processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 replaced {name}: ok (vsd_{date}.bmp) read DATE_TIME_ORIGINAL: 2015-08-01_22-22-45 replaced {date}: ok (vsd_2015-08-01_22-22-45.bmp) output file: new_folder\vsd_2015-08-01_22-22-45.bmp output type is: bmp cannot use the metadata: TiffOutputSet does not match output type bmp! create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.bmp.BMPImageWriter) write iioimage ... ok (vsd_2015-08-01_22-22-45.bmp) output file size: 175 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 515 millisecond(s) total input size: 22 KB total output size: 175 KB (=774%) |
Example: reading a SVG image and convert it to PNG
java -jar SJIT.jar -in logo.svg -out logo.png
processing image file: logo.svg file size: 8 KB select image reader ... ok (org.apache.batik.transcoder.image.ImageTranscoder) image type: svg read image ... ok number of frames: 1 read metadata ... no metadata processing frame: 0/0 image type: TYPE_INT_ARGB image dimension: 400x400 output file: logo.png output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (logo.png) output file size: 16 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 766 millisecond(s) total input size: 8 KB total output size: 16 KB (=205%) |
Files with multiple image frames
-out
in a different file format.Example: writing all frames of a GIF animation to PNG files
java -jar SJIT.jar -in davinci.gif -out davinci.png
processing image file: davinci.gif file size: 61 KB select image reader ... ok (com.sun.imageio.plugins.gif.GIFImageReader) image type: gif read image ... ok number of frames: 2 read metadata ... ok (com.sun.imageio.plugins.gif.GIFImageMetadata) processing frame: 1/2 image type: TYPE_BYTE_BINARY image dimension: 782x792 output file: davinci-frame1.png output type is: png cannot use the metadata: GIFImageMetadata does not match output type png! create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (davinci-frame1.png) output file size: 28 KB processing frame: 2/2 image type: TYPE_BYTE_BINARY image dimension: 782x792 output file: davinci-frame2.png output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (davinci-frame2.png) output file size: 30 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 557 millisecond(s) total input size: 61 KB total output size: 58 KB (=95%) |
Modify image
-out
is
given then the input file will be modified and a backup of the original file will be created in the
folder .SJIT.backup.
Transfer colors:
With the argument-color [x]->[y]
the color [x] will be changed
to [y]. There are different options to denote colors:
- 8 character hex code (ARGB). Example: #99AC03F7 (Alpha=0x99,Red=0xAC,Green=0x03,Blue=0xF7)
- 6 character hex code (RGB). Example: #AC03F7 (then Alpha is always 0xFF (fully non-transparent))
- 3 character hex code (RGB). Example: #AC3 (Alpha=0xFF,Red=0xAA,Green=0xCC,Blue=0x33)
- 3 decimal numbers (R,G,B). Example: 127,88,250 (Alpha=0xFF,Red=0x7F,Green=0x58,Blue=0xFA)
- 4 decimal numbers (A,R,G,B). Example: 20,127,88,250 (Alpha=0x14,Red=0x7F,Green=0x58,Blue=0xFA)
- Special literals like 'white','red','green','blue','gray',...
- Special literal 'transparent' (then Alpha is always 00 (fully transparent))
Please note: operating systems tend to treat the character
>
as a redirecting operator which will result in an incorrect program call. That is why special charaters like >
needs to be escaped on the command line. On Windows this is: ^>
(for example -color red-^>green
)Example: make the blue color of this map a bit darker
java -jar SJIT.jar -in map.png -color AAD3DF->44A9FB -out map-new.png
processing image file: map.png file size: 21 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 transform color: #aad3df -> #44a9fb ... ok output file: map-new.png output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (map-new.png) output file size: 19 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 147 millisecond(s) total input size: 21 KB total output size: 19 KB (=91%) |
Make a color transparent:
Just like normal color changing the special literal 'transparent' can be used to make a certain color completely transparent.Please note: transparency is not supported by all image types!
Example: make the blue color of this map transparent. For better visualization there is a background image (wave lines) in the following HTML section to demonstrate the transparency.
java -jar SJIT.jar -in map.png -color AAD3DF->transparent -out map-transparent.png
processing image file: map.png file size: 21 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 transform to 4BYTE_ABGR: ok transform color: #aad3df -> #00aad3df ... ok output file: map-transparent.png output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (map-transparent.png) output file size: 20 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 110 millisecond(s) total input size: 21 KB total output size: 20 KB (=93%) |
Remove alpha channel:
The-removeAlpha
command can be used to remove the alpha channel from the image
and make it completely non-transparent. The image encoding will be changed from 4-Byte (ARGB) to 3-Byte (RGB).
Change hue/saturation/brightness/contrast:
The-addHue/-addSat/-addBright/-addContrast +/-[x]
command can be used to add or reduce the hue/saturation/brightness/contrast
in the image. [x] can be in the range -1.0 to 1.0 where -1.0 means removing completely and +1.0 is maximum.
Example: make the image a bit brighter
java -jar SJIT.jar -in vsd.jpg -addBright +0.1 -out vsd-brighter.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 change brightness ... ok (added 0.1) output file: vsd-brighter.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-brighter.jpg) remove temp file ... ok output file size: 22 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 705 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
Example: remove all hue from the image
java -jar SJIT.jar -in vsd.jpg -addHue -1.0 -out vsd-withoutHue.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 change hue ... ok (added -1.0) output file: vsd-withoutHue.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-withoutHue.jpg) remove temp file ... ok output file size: 22 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 690 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
Change red/green/blue/alpha:
The-addRed/-addGreen/-addBlue/addAlpha +/-[x]
command can be used to add or reduce the red/green/blue/alpha
in the image. [x] can be in the range -1.0 to 1.0 where -1.0 means removing completely and +1.0 is maximum. Example: make the image a stop greener
java -jar SJIT.jar -in vsd.jpg -addGreen +0.1 -out vsd-greener.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 change green ... ok (added 0.1) output file: vsd-greener.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-greener.jpg) remove temp file ... ok output file size: 22 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 676 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
Example: make the complete image half transparent. For better visualization there is a background image added.
java -jar SJIT.jar -in map.png -addAlpha +0.5 -out map-half.png
processing image file: map.png file size: 21 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 change alpha ... ok (added 0.5) output file: map-half.png output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (map-half.png) output file size: 20 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 275 millisecond(s) total input size: 21 KB total output size: 20 KB (=94%) |
Resize image:
The-resize [x]
command can be used to resize the image to [x]. [x] can be either
a ratio in percent (e.g. 50%), then the image will be resized to 50% of its original width and height (so effectively 1/4 image area).
Or [x] can be the absolute destination width in pixel (e.g. 120px) then the width will be 120px and the height will be
calculated to its new value so that the image format remains the same.
Please note: for JPG images: if the image has EXIF meta data, that data will automatically be adjusted to the new image size.
Example: resize to 80% width and height
java -jar SJIT.jar -in vsd.jpg -resize 80% -out vsd-smaller.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.Tiff... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 resize ... ok (new size: 160x240) output file: vsd-smaller.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=160 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=240 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=160 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=240 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImageWriter) write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-smaller.jpg) remove temp file ... ok output file size: 18 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 834 millisecond(s) total input size: 22 KB total output size: 18 KB (=82%) |
Cut image:
The commands-cutLeft/-cutRight/-cutTop/-cutBottom [x]
can be used to cut (crop) parts of the image.
[x] can be either a ratio in percent (e.g. 50%) or a size in pixel (e.g. 12px). For example -cutLeft 10px
means
to cut away 12px from the left site of the image (the resulting image width will be 12px smaller; the height remains unchanged).
-cutBottom 10%
means to cut away 10% of the image height from the bottom. If the image would be 200px
height then this would lead to 20px being cutted away from the bottom of the image.
Please note: for JPG images: if the image has EXIF meta data, that data will automatically be adjusted to the new image size.
Example: cut 20px from each site of the input image
java -jar SJIT.jar -in vsd.jpg -cutLeft 20px -cutRight 20px -cutTop 20px -cutBottom 20px
-out vsd-cutted.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.Tiff... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 cut left ... ok (new size: 190x300) cut right ... ok (new size: 180x300) cut top ... ok (new size: 180x290) cut bottom ... ok (new size: 180x280) output file: vsd-cutted.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=180 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=280 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=180 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=280 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImageWriter) write iioimage ... ok (tmpImg.png) rewrite Exif data ... rewrite with metadata... ok (vsd-cutted.jpg) remove temp file ... ok ok output file size: 21 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 194 millisecond(s) total input size: 22 KB total output size: 21 KB (=93%) |
Invert image:
The-invert
command can be used invert the image. For every RGB color value
the new value is 255-value. Inverting does NOT affect the alpha values (so transparency values remain the same)!
Example:
java -jar SJIT.jar -in vsd.jpg -invert -out vsd-inverted.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 invert the image ... ok output file: vsd-inverted.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-inverted.jpg) remove temp file ... ok output file size: 22 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 364 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
Make image grayscale:
The-makeGrayscale
command can be used to make the image grayscale. For every RGB color value
the new value is average of RGB. Making grayscale does NOT affect the alpha values (so transparency values remain the same)!
Example:
java -jar SJIT.jar -in vsd.jpg -makeGrayscale -out vsd-grey.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 make image grayscale ... ok output file: vsd-grey.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-grey.jpg) remove temp file ... ok output file size: 21 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 398 millisecond(s) total input size: 22 KB total output size: 21 KB (=95%) |
Rotate image:
» Rectangular rotation:
With the-rotate [x]
command the input image can be rotated left ([x]=left
or -90°
),
right ([x]=right
or 90°
) or half ([x]=half
or 180°
). The resulting image size will be set properly.
Example:
java -jar SJIT.jar -in vsd.jpg -rotate left -out vsd-left.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.for... processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 rotate the image ... ok (left) output file: vsd-left.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=300 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=200 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-left.jpg) remove temp file ... ok output file size: 22 KB ----------------------------------------------------... processed 1 image(s) in 271 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
» Custom angle rotation:
With the rotation command [x] can also be a custom angle in the range 0° - 360° (means clockwise rotation, negative angles denote rotation against the clock). In contrast to the rectangular rotation, if no other command is given, the image size will not be changed. This leads to the image corners being cropped and empty corners.Please note: rotation point is always the center of the image.
Example: rotation by -10° (=350° clockwise)
java -jar SJIT.jar -in horizont.jpg -rotate -10° -out horizont-rotated.jpg
» Custom angle rotation with autoCut:
The command-autoCut
is designed to automatically cut the rotated image so that no empty corners occur. This leads to the resulting image being smaller and loss of image information!
-autoCut
only has effect in combination with a rotation by a custom angle.
Example: rotation by -10° with autoCut
java -jar SJIT.jar -in horizont.jpg -rotate -10° -autoCut -out horizont-rotated-autoCut.jpg
» Custom angle rotation with autoExtend:
The command-autoExtend
is the opposite of -autoCut
and designed to automatically extend the image size so that the rotated image fits in it. -autoExtend
only has effect in combination with a rotation by a custom angle.
Example: rotation by -10° with autoExtend
java -jar SJIT.jar -in horizont.jpg -rotate -10° -autoExtend -out horizont-rotated-autoExtend.jpg
» Custom angle rotation with autoExtend and fillColor:
With the command-fillColor [x]
a color [x] can be given to be used as background color for the empty corners. See section Transfer colors on how to denote colors.
Please note: transparent colors are not supported in JPG images.
Example: rotation by -10° with autoExtend and fillColor white (note that white is not equal to transparent)
java -jar SJIT.jar -in horizont.jpg -rotate -10° -autoExtend -fillColor white
-out horizont-rotated-autoExtend-white.jpg
» Custom angle rotation with autoExtend and transparent fillColor:
With the command-fillColor transparent
the rotation corners can be made transparent. But because JPG images do not support transparency the output image
has to be PNG. (PNG is actually not designed for photographs, that is why the output file will be significantly bigger than the input JPG). For better visualization there is a background image (wave lines) in the following HTML section to demonstrate the transparency.
Example: rotation by -10° with autoExtend and fillColor transparent
java -jar SJIT.jar -in horizont.jpg -rotate -10° -autoExtend -fillColor transparent
-out horizont-rotated-autoExtend-transparent.png
Mirror image:
With the-mirrorH/-mirrorV
command the input image can mirrored horizontally or vertically.
Example:
java -jar SJIT.jar -in vsd.jpg -mirrorV -out vsd-mirrorV.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 mirror vertically ... ok output file: vsd-mirrorV.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImageWriter) write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd-mirrorV.jpg) remove temp file ... ok output file size: 22 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 280 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
Split image:
The-splitH/-splitV [x]
command can be used to split the image
horizontally or vertically at width/height [x] in two parts. Just like resize [x] can also be
a percent number (e.g. 50% → split at half).For that command no
-out
is required because there will be two output file with suffix top/bottom resp. left/right.
Example: split the image horizontally at 100px
In combination with the option java -jar SJIT.jar -in vsd.jpg -splitH 100px
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 no -out file specified cut horizontally ... ok (top=100px, bottom=200px) output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=100 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=100 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_top.jpg) remove temp file ... ok output file size: 15 KB output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=200 changing EXIF ... ok (directory=Exif) ... |
-splitSlices
the image can be splitted into multiple slices of width/height [x].
Example: split the image vertically into four slices
java -jar SJIT.jar -in vsd.jpg -splitV 25% -splitSlices
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 no -out file specified cut vertically ... slice ... 0 (0-50) vsd_0.jpg slice ... 1 (50-100) vsd_1.jpg slice ... 2 (100-150) vsd_2.jpg slice ... 3 (150-200) vsd_3.jpg output type is: jpg ... |
Change JPG quality:
The-jpgQuality [x]%
command can be used to reduce the JPG quality
where [x] can range from 0 (low quality) to 100 (quality unchanged). This operation can reduce
the file size siginficantly.Please note: the output quality can never be better than the input quality ;-)
Example:
java -jar SJIT.jar -in vsd.jpg -jpgQuality 10% -out vsd_lower-qual.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 output file: vsd_lower-qual.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... set the JPG quality ... ok (is 10.0) write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_lower-qual.jpg) remove temp file ... ok output file size: 20 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 787 millisecond(s) total input size: 22 KB total output size: 20 KB (=90%) |
Combine images
Difference between two images:
The-diff [file]
command allows for calculating the difference
image between the image from [file] and the input image (from -in). In case of no difference
the result is 0 (=black). If you want the white color to indicate no difference you can invert the
output image (Please note that inverting will not have the desired effect when using it directly together
with the -diff command, because inverting will always be applied to the input image, not the output image).
Please note: If both input images have different sizes the output image will have the smaller width/height.
Example: find the difference of two similar looking input images.
java -jar SJIT.jar -in house_left.png -diff house_right.png -out house_diff.png
java -jar SJIT.jar -in house_diff.png -invert -out house_diff_inverted.png
processing image file: house_left.png file size: 59 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 1/1 image type: TYPE_4BYTE_ABGR image dimension: 320x320 reading image file ... ok (house_right.png) creating difference img: ok (320x320) output file: house_diff.png output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (house_diff.png) output file size: 50 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 359 millisecond(s) total input size: 59 KB total output size: 50 KB (=84%) |
Add (overlay) two images:
The-add [file]
command allows for painting the image [file]
over the input image. Combined with the -pos [x,y]
you can specify where to place the image to be added.
Example: add a watermark image (that has size 150x28) at bottom right corner
java -jar SJIT.jar -in vsd.jpg -add watermark.png -out vsd_watermark.jpg -pos -150,-28
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 print pixel value ... [50|272]:0xff8ea0ac,a=255,r=142,g=160,b=172 reading image file ... ok (watermark.png) draw over input image ...ok output file: vsd_watermark.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.jpeg.JPEGImage... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_watermark.jpg) remove temp file ... ok output file size: 23 KB ------------------------------------------------------- 1/1 processed 1 image(s) in 441 millisecond(s) total input size: 22 KB total output size: 23 KB (=101%) |
Concatenate two images:
The-concatLeft/-concatRight/-concatTop/-concatBottom [file]
command allows concatenating two
images so that the image from [file] is painted next to the input image as described by left/right/top/bottom.
Please note: If the images do not have the same size the remaining area will be filled in black (if not otherwise specified by
-fillColor
).Example: concatenate two images horizontally
java -jar SJIT.jar -in vsd.jpg -concatRight arh.jpg -out concat.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sans... processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 reading image file ... ok (arh.jpg) creating combined image: ok (400x300) output file: concat.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=400 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=400 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (concat.jpg) remove temp file ... ok output file size: 30 KB --------------------------------------------... processed 1 image(s) in 420 millisecond(s) total input size: 22 KB total output size: 30 KB (=134%) |
» Concatenate with fillColor:
If concatenation leaves empty spaces the command-fillColor [x]
can be used to specify the background color.
Example: concatenate on the left side with fillColor white (note that white is not equal to transparent)
java -jar SJIT.jar -in vsd.jpg -concatLeft arh.jpg -fillColor white -out concat-white.jpg
» Concatenate with transparent fillColor:
With the command-fillColor transparent
the concatenation background can be made transparent. But because JPG images do not support transparency the output image has to be PNG.
(PNG is actually not designed for photographs, that is why the output file will be significantly bigger than the input JPG). For better visualization there is a background image (wave lines) in the following HTML section to demonstrate the transparency.
Example: concatenate on the right side with fillColor transparent
java -jar SJIT.jar -in vsd.jpg -concatRight arh.jpg -fillColor transparent -out concat-transparent.png
EXIF functions
List all EXIF tags:
The-listExifTags
functions lists all EXIF tags and their data type
supported by this program. The function does not need any input, it only lists all available tags. If you
want to read all EXIF data in an image file then use -printMeta
.
Directory ROOT:
IMAGE_WIDTH | Short | IMAGE_LENGTH | Short | BITS_PER_SAMPLE | Short |
COMPRESSION | Short | DOCUMENT_NAME | ASCII | IMAGE_DESCRIPTION | ASCII |
MAKE | ASCII | MODEL | ASCII | PAGE_NAME | ASCII |
PAGE_NUMBER | Short,Short | SOFTWARE | ASCII | DATE_TIME | ASCII |
ARTIST | ASCII | HOST_COMPUTER | ASCII | TILE_WIDTH | Short |
TILE_LENGTH | Short | TILE_OFFSETS | Long | TILE_BYTE_COUNTS | Short |
INK_SET | Short | INK_NAMES | ASCII | NUMBER_OF_INKS | Short |
DOT_RANGE | Short | TARGET_PRINTER | ASCII | COPYRIGHT | ASCII |
IMAGE_HEIGHT | Long | MODIFY_DATE | ASCII | RATING | Short |
RATING_PERCENT | Short | SEMINFO | ASCII | UNIQUE_CAMERA_MODEL | ASCII |
LOCALIZED_CAMERA_MODEL | ASCII | CAMERA_SERIAL_NUMBER | ASCII |
Directory EXIF:
DATE_TIME_ORIGINAL | ASCII | CREATE_DATE | ASCII |
IMAGE_NUMBER | Long | SECURITY_CLASSIFICATION | ASCII |
IMAGE_HISTORY | ASCII | SUBJECT_LOCATION | Short,Short,Short,Short |
SUB_SEC_TIME | ASCII | SUB_SEC_TIME_ORIGINAL | ASCII |
SUB_SEC_TIME_DIGITIZED | ASCII | FLASHPIX_VERSION | Undefined |
COLOR_SPACE | Short | EXIF_IMAGE_WIDTH | Short |
EXIF_IMAGE_LENGTH | Short | RELATED_SOUND_FILE | ASCII |
FLASH_ENERGY | Rational | FOCAL_PLANE_XRESOLUTION | Rational |
FOCAL_PLANE_YRESOLUTION | Rational | FOCAL_PLANE_RESOLUTION_UNIT | Short |
EXPOSURE_INDEX | Rational | SENSING_METHOD | Short |
FILE_SOURCE | Undefined | SCENE_TYPE | Undefined |
CFAPATTERN | Undefined | CUSTOM_RENDERED | Short |
EXPOSURE_MODE | Short | WHITE_BALANCE | Short |
DIGITAL_ZOOM_RATIO | Rational | FOCAL_LENGTH_IN_3_5MM_FORMAT | Short |
SCENE_CAPTURE_TYPE | Short | GAIN_CONTROL | Short |
CONTRAST | Short | SATURATION | Short |
SHARPNESS | Short | SUBJECT_DISTANCE_RANGE | Short |
IMAGE_UNIQUE_ID | ASCII | GAMMA | Rational |
OFFSET_SCHEMA | SLong | OWNER_NAME | ASCII |
SERIAL_NUMBER | ASCII | LENS | ASCII |
RAW_FILE | ASCII | CONVERTER | ASCII |
EXPOSURE | ASCII | SHADOWS | ASCII |
BRIGHTNESS | ASCII | SMOOTHNESS | ASCII |
MOIRE_FILTER | ASCII | USERCOMMENT | Undefined |
MAKER_NOTE | Undefined |
Directory GPS:
GPS_VERSION_I | Byte,Byte,Byte,Byte | GPS_LATITUDE_RE | ASCII |
GPS_LATITUD | Rational,Rational,Rational | GPS_LONGITUDE_RE | ASCII |
GPS_LONGITUD | Rational,Rational,Rational | GPS_ALTITUDE_RE | Byte |
GPS_ALTITUD | Rational | GPS_TIME_STAM | Rational,Rational,Rational |
GPS_SATELLITE | ASCII | GPS_STATU | ASCII |
GPS_MEASURE_MOD | ASCII | GPS_DO | Rational |
GPS_SPEED_RE | ASCII | GPS_SPEE | Rational |
GPS_TRACK_RE | ASCII | GPS_TRAC | Rational |
GPS_IMG_DIRECTION_RE | ASCII | GPS_IMG_DIRECTIO | Rational |
GPS_MAP_DATU | ASCII | GPS_DEST_LATITUDE_RE | ASCII |
GPS_DEST_LATITUD | Rational,Rational,Rational | GPS_DEST_LONGITUDE_RE | ASCII |
GPS_DEST_LONGITUD | Rational,Rational,Rational | GPS_DEST_BEARING_RE | ASCII |
GPS_DEST_BEARIN | Rational | GPS_DEST_DISTANCE_RE | ASCII |
GPS_DEST_DISTANC | Rational | GPS_DATE_STAM | ASCII |
GPS_DIFFERENTIA | Short |
Remove all metadata:
The-removeMeta
command will remove all metadata from
the input file. Only the image itself will be left in the file.
Print metadata:
The-printMeta
command will print all metadata read from the
input file.
The following metadata formats can be displayed (if present):
Example: print all available metadata of an input JPG
java -jar SJIT.jar -in vsd.jpg -printMeta
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) image metadata: byteOrder: 73 (=little endian) Exif metadata: Root: Image Width: 200 Image Length: 300 Make: 'Canon' Model: 'Canon EOS 1100D' XResolution: 240 YResolution: 240 Resolution Unit: 2 Software: 'Adobe Photoshop Lightroom 5.5 (Windows)' Date Time: '2015:09:13 19:19:38' Artist: 'iZ PRODUCTION' Copyright: 'RESERVED' Exif Offset: 288 Exif: Exposure Time: 1/1000 (0,001) FNumber: 45/10 (4,5) Exposure Program: 3 ISO: 100 Unknown Tag (0x8830): 2 Unknown Tag (0x8832): 100 Exif Version: 48, 50, 51, 48 Date Time Original: '2015:08:01 22:22:45' Create Date: '2015:08:01 22:22:45' Shutter Speed Value: 9965784/1000000 (9,966) Aperture Value: 433985/100000 (4,34) Exposure Compensation: 0 Max Aperture Value: 425/100 (4,25) Metering Mode: 5 Flash: 16 Focal Length: 28 Sub Sec Time Original: '00' Sub Sec Time Digitized: '00' Color Space: 1 Exif Image Width: 200 Exif Image Length: 300 Focal Plane XResolution: 4272000/905 (4.720,442) Focal Plane YResolution: 2848000/595 (4.786,555) Focal Plane Resolution Unit: 2 Custom Rendered: 0 Exposure Mode: 0 White Balance: 1 Scene Capture Type: 0 Unknown Tag (0xa431): '118062044820' Unknown Tag (0xa432): 18, 200, Invalid rational (0/0), Invalid rational (0/0) Unknown Tag (0xa434): '18-200mm' Unknown Tag (0xa435): '0000000000' Sub: (jpegImageData) Compression: 6 XResolution: 72 YResolution: 72 Resolution Unit: 2 Jpg From Raw Start: 960 Jpg From Raw Length: 11646 No Photoshop (IPTC) metadata. No XMP metadata. processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 no -out file specified ------------------------------------------------------- 1/1 processed 1 image(s) in 1297 millisecond(s) total input size: 22 KB total output size: 0 B (=0%) |
Print date:
The-printDate
command will print the
EXIF date field DATE_TIME_ORIGINAL (if present). In JPG images this is the timestamp where the pricture
was taken originally. This is the date that will be used by the wildcard {date} in the -out option.
Default date format is yyyy-MM-dd_HH-mm-ss (can be changed by
-dateFormat
option).
Example:
java -jar SJIT.jar -in vsd.jpg -printDate
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.for... read DATE_TIME_ORIGINAL: 2015-08-01_22-22-45 processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x300 no -out file specified ------------------------------------------------------- 1/1 processed 1 image(s) in 357 millisecond(s) total input size: 22 KB total output size: 0 B (=0%) |
Set date:
The-setDate [x]
command will set the
EXIF date field DATE_TIME_ORIGINAL (if possible) to [x]. [x] can either be the absolute timestamp value
in the format yyyy-MM-dd_HH-mm-ss (can be changed by -dateFormat
option) or
be a relative number of seconds to add/reduce to the current value (pattern is then +/-[x]).
In JPG images DATE_TIME_ORIGINAL is the timestamp where the pricture was taken originally. This is the date that will be used by the wildcard {date} in the -out option.
Example: set an absolute timestamp
java -jar SJIT.jar -in vsd.jpg -setDate 2019-07-31_12-58-47 -out vsd_newDate1.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.for... processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 new DATE_TIME_ORIGINAL: 2019-07-31_12-58-47 setting new EXIF data... ok output file: vsd_newDate1.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_newDate1.jpg) remove temp file ... ok output file size: 22 KB ----------------------------------------------------... processed 1 image(s) in 213 millisecond(s) total input size: 22 KB total output size: 22 KB (=100%) |
Example: add 3600 seconds (=1 hour) to the current timestamp
java -jar SJIT.jar -in vsd.jpg -setDate +3600 -out vsd_newDate2.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.for... processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 read DATE_TIME_ORIGINAL: 2015-08-01_22-22-45 adding 3600s ... ok new DATE_TIME_ORIGINAL: 2015-08-01_23-22-45 setting new EXIF data... ok output file: vsd_newDate2.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_newDate2.jpg) remove temp file ... ok output file size: 22 KB ----------------------------------------------------... processed 1 image(s) in 254 millisecond(s) total input size: 22 KB total output size: 22 KB (=100%) |
Set arbitrary EXIF data:
The-setExif [x]=[y]
command allows for setting any
EXIF field named [x] to the value [y]. See -listExifTags
for a list of all supported EXIF tags and their data types. Use double quotes if the value [y] shall contain spaces!Please note: if the specified tag [x] does not yet exist, it will be created. If it already exists, it will be overwritten.
Example: set EXIF fields author (=ARTIST), programm name (=SOFTWARE) and copyright (=COPYRIGHT) to new values
java -jar SJIT.jar -in vsd.jpg -setExif ARTIST="unknown Author" -setExif SOFTWARE="edited by SJIT" -setExif COPYRIGHT="open for everyone" -out vsd_newExif1.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.for... processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 setting new EXIF data: SOFTWARE=edited by SJIT changing EXIF ... ok (directory=Root) setting new EXIF data: ARTIST=unknown Author changing EXIF ... ok (directory=Root) setting new EXIF data: COPYRIGHT=open for everyone changing EXIF ... ok (directory=Root) output file: vsd_newExif1.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_newExif1.jpg) remove temp file ... ok output file size: 22 KB ----------------------------------------------------... processed 1 image(s) in 219 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
Remove EXIF data:
The-removeExif [x]
command allows for removing any
EXIF field named [x]. See -listExifTags
for a list of all supported EXIF tags.Please note: if the specified tag [x] does not yet exist, the command will have no effect.
Example: remove the date time original and the create date field
java -jar SJIT.jar -in vsd.jpg -removeExif DATE_TIME_ORIGINAL -removeExif CREATE_DATE -out vsd_newExif2.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.for... processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 removing EXIF data: CREATE_DATE changing EXIF ... ok (directory=Exif) removing EXIF data: DATE_TIME_ORIGINAL changing EXIF ... ok (directory=Exif) output file: vsd_newExif2.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_newExif2.jpg) remove temp file ... ok output file size: 22 KB ----------------------------------------------------... processed 1 image(s) in 201 millisecond(s) total input size: 22 KB total output size: 22 KB (=99%) |
Set GPS data:
The-setGps [x]
command allows for setting/adding
GPS data to the image (if possible). [x] is expected in decimal degrees.
Example: set GPS to 51.312445,12.413173
java -jar SJIT.jar -in vsd.jpg -setGps 51.312445,12.413173 -out vsd_gps.jpg
processing image file: vsd.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins... image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.for... processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 setting new GPS data ... ok (51.31245,12.41317) output file: vsd_gps.jpg output type is: jpg setting new EXIF data: EXIF_IMAGE_WIDTH=200 changing EXIF ... ok (directory=Exif) setting new EXIF data: EXIF_IMAGE_LENGTH=300 changing EXIF ... ok (directory=Exif) setting new EXIF data: IMAGE_WIDTH=200 changing EXIF ... ok (directory=Root) setting new EXIF data: IMAGE_HEIGHT=300 changing EXIF ... ok (directory=Root) create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins... write iioimage ... ok (tmpImg.png) rewrite with metadata... ok (vsd_gps.jpg) remove temp file ... ok output file size: 22 KB ----------------------------------------------------... processed 1 image(s) in 275 millisecond(s) total input size: 22 KB total output size: 22 KB (=100%) |
Print GPS data:
The-printGps
command allows for printing the current GPS data (if possible)
and creating a web link to openstreetmap.
Example:
java -jar SJIT.jar -in vsd_gps.jpg -printGps
processing image file: vsd_gps.jpg file size: 22 KB select image reader ... ok (com.sun.imageio.plugins.jpeg.JPEGImageReader) image type: jpg read image ... ok number of frames: 1 read metadata ... ok (org.apache.sanselan.formats.tiff.write.TiffOutputSet) processing frame: 0/0 image type: TYPE_3BYTE_BGR image dimension: 200x300 reading GPS data ... ok (51.31245,12.41317) openstreetmap URL: https://www.openstreetmap.org/#map=18/51.31245/12.41317 no -out file specified ------------------------------------------------------- 1/1 processed 1 image(s) in 238 millisecond(s) total input size: 22 KB total output size: 0 B (=0%) |
Remove GPS data:
The-removeGps
command simply removes the GPS data (if exists).Process multiple files (batch)
-in [file]
is a directory or a pattern then all
image files in this directory or matching the pattern will be processed.Some examples:
-in dir/subDir | Process all image files in the directory dir/subDir (assuming both 'dir' and 'subDir' are readable directories). The path is relative to the current working directory. Only files with known file name extensions will be processed. All other files are ignored! |
-in C:/UserX/dir/subDir | Same as above but with absolute path. |
-in dir/subDir/...jpg | Same as first example but with additional file name filter. Only JPG files are considered. Please note: in previous version the pattern operator was '*' (like regex '.*') but the operating systems tend to automatically replace patterns like '*.jpg' which will result in an incorrect program call. That is why the pattern indicator was changed to '...' from version 1.6.2. |
-in . | Process all image files in the current working directory. |
-in . -r | Process all image files in the current working directory, including all subdirectories (recursive). |
-in ...jpg | Process all JPG files in the current working directory. |
-in ...jpg -r | Process all JPG files in the current working directory, including all subdirectories (recursive). |
-in DSCN...jpg | Process all JPG files in the current working directory, which start with the prefix 'DSCN'. This can of course be combined with the directory examples from above. |
-f | To avoid mistakes on a large number of input files by default the program prints a summary and prompts for user input to proceed. By use of the -f (force) option prompting for input can be suppressed. (This could be useful if the program is called by another program) |
Example: add watermark to a group of images
In this example all JPG images in the directory 'myDir' shall get a watermark image in the bottom right corner.
The watermark is outside of the directory and has the size 150x28. We don't specify a -out file so the
input files will be modified directly (and a backup is created at '.SJIT.backup'). Also we set the program name
in the EXIF field.
java -jar SJIT.jar -in myDir\...jpg -pos -150,-28 -add watermark.png -setExif SOFTWARE="edited by SJIT"
Explanation:
-in myDir\...jpg
: process all JPG files in the folder 'myDir' (just in case there are other files which shall be ignored; if the folder contains all the image to be process only then '-in myDir' would do the trick, too)-pos -150,-28
: position the cursor at 150px left from the right border and 28px above the bottom-add watermark.png
: draw 'watermark.png' (which is located outside of 'myDir') over the input image at the position where the cursor is put-setExif SOFTWARE="edited by SJIT"
: modify the EXIF field SOFTWARE
Example: resize a group of images
In this example all JPG images in the directory 'myDir' shall be resized to 80% (width & height each).
This time we specify an output directory and a file name with prefix 'resized_'.
java -jar SJIT.jar -in myDir\...jpg -resize 80% -setExif SOFTWARE="edited by SJIT" -out myDir\resized\smaller_{name}.jpg
Explanation:
-in myDir\...jpg
: process all JPG files in the folder 'myDir' (just in case there are other files which shall be ignored; if the folder contains all the image to be process only then '-in myDir' would do the trick, too)-resize 80%
: resize width & height by 80% (so effectively 64% image size)-setExif SOFTWARE="edited by SJIT"
: modify the EXIF field SOFTWARE-out myDir\resized\smaller_{name}.jpg
: write the output images to a subdirectory 'resized' (will be created) and use the file name 'smaller_{name}.jpg' where {name} will be replaced by the file name of the input image
Create GIF animations
If there are multiple input files and the output file (-out) is a GIF file, then a GIF animation will be created. All input files become one frame of the GIF animation in the order of their processing. The default delay between the frames is 1 second and by default the animation will be repeated endlessly.The following parameters can be used to change the defaults:
-gifDelay [x]
set the delay for frame changing in the animation to [x] milliseconds. Default is 1000 (=1 second).-gifDelay [[x1],[x2],[x3]...]]
set separate delays for each frame. For example:-gifDelay [100,200,2000]
100ms for delay between first frame and second frame; 200ms to third frame; 2s to fourth frame; and so on... If there are more frames than elements in the array the last array element will be applied for all following frames.-gifLoopCount [x]
set the loop count for repeating the animation to [x]. 0 means infinite looping (repeat endlessly), this is the default.-gifLoopDelay [x]
set the delay between two loop iterations to [x] milliseconds. This is nothing different than the delay after the last frame before the next loop starts. Default value is the delay given by -gifDelay.
Please note: make sure the -in parameter is a directory or a pattern that covers all images to be included in the animation!
Also make sure the images ordered by their file name is the order that you wish to appear in the animation.
Example 1: create a GIF animation from 5 transparent PNG images with 500ms delay between the frames and infinite repetition.
java -jar SJIT.jar -in myDir\...png -gifDelay 500 -out myDir\animation.gif
input file is a directory... added 5 images from directory The following files will be processed: myDir\smiley1.png myDir\smiley2.png myDir\smiley3.png myDir\smiley4.png myDir\smiley5.png Summary: - process 5 input files - write the processed files to myDir\animation.gif - for the gif animation: 500ms delay between the frames - for the gif animation: loop count=0 (infinite) Is that what you want? [yes] yes processing image file: smiley1.png file size: 6 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 0/0 image type: TYPE_4BYTE_ABGR image dimension: 128x128 output file: myDir\animation.gif create gif animation ... ok (animation.gif) attach to gif animation: ok ------------------------------------------------------- 1/5 processing image file: smiley2.png file size: 6 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 0/0 image type: TYPE_4BYTE_ABGR image dimension: 128x128 output file: myDir\animation.gif attach to gif animation: ok ------------------------------------------------------- 2/5 processing image file: smiley3.png file size: 6 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 0/0 image type: TYPE_4BYTE_ABGR image dimension: 128x128 output file: myDir\animation.gif attach to gif animation: ok ------------------------------------------------------- 3/5 processing image file: smiley4.png file size: 6 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 0/0 image type: TYPE_4BYTE_ABGR image dimension: 128x128 output file: myDir\animation.gif attach to gif animation: ok ------------------------------------------------------- 4/5 processing image file: smiley5.png file size: 6 KB select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 0/0 image type: TYPE_4BYTE_ABGR image dimension: 128x128 output file: myDir\animation.gif attach to gif animation: ok ------------------------------------------------------- 5/5 finish gif animation ... ok processed 5 image(s) in 191 millisecond(s) total input size: 33 KB total output size: 22 KB (=66%) |
Example 2: create a GIF animation from 5 transparent PNG images with 500ms delay between the frames, infinite repetition and 3000ms delay between the loop iterations.
java -jar SJIT.jar -in myDir\...png -gifDelay 500 -gifLoopDelay 3000 -out myDir\animation2.gif
Example 3: create a GIF animation from 5 transparent PNG images with infinite repetition and custom delays between the frames: 500ms → 1000ms → 2000ms → 3000ms → 4000ms (since we have 5 frames 4000ms is the delay between the last frame and restart of the loop).
java -jar SJIT.jar -in myDir\...png -gifDelay [500,1000,2000,3000,4000] -out myDir\animation3.gif
Conditions (include/exclude files)
As explained in chapter Process multiple files the-in
option can denote multiple files to be processed (input parameter is a directory or a pattern).
If there are multiple files to be processed the following options exist to exclude images from the list:
- file size:
-minSize/-maxSize [x]
to only process files which are greater/smaller than [x] in Bytes. (Example:-minSize 2MB
will only process files greater/equals than 2 Megabytes) - image width:
-minWidth/-maxWidth [x]px
to only process images which are greater/smaller than [x] Pixels in width. (Example:-maxWidth 2000px
will only process files smaller/equals than 2000 Pixels in width) - image height:
-minHeight/-maxHeight [x]px
to only process images which are greater/smaller than [x] Pixels in height. (Example:-minHeight 100px
will only process files greater/equals than 2000 Pixels in height)
Create new images
New plain color image
With the command-new [x]x[y]
a new plain 4 Byte AGBR image of width [x] and height [x]
will be created (temporary file name is 'tmpImg.png'). The image will be filled fully transparent in black (0x00000000).
Combined with the -change [x]->[y]
option the color of the
newly created image can be changed, where 0 denotes the initial color.
Alternatively
-fillColor [x]
can be used to specify the background color of the newly created image.
Example: Create a plain gray image of size 200x200
java -jar SJIT.jar -new 200x200 -change 0->gray -out gray.png
create new plain image java.awt.Dimension[width=200,height=200] -> true processing image file: tmpImg.png file size: 234 B select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 0/0 image type: TYPE_4BYTE_ABGR image dimension: 200x200 transform color: 0 -> ff808080 ... ok output file: gray.png remove temp file ... ok output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (gray.png) output file size: 472 B ------------------------------------------------------- 1/1 processed 1 image(s) in 49 millisecond(s) total input size: 234 B total output size: 472 B (=201%) |
Create QR code images
With the command-newQr [QR code message]
a new QR code image
can be created (using the zxing library).
By default the image has the size 100x100 pixels. Combined with the -new [width]x[height]
option the image size to be used can be set.Please note: Unfortunately by now zxing can only create QR code images and no other barcode type.
Be aware of spaces in the QR code message! Depending on the underlying OS spaces have to be escaped or the
entire text needs to be wrapped in quotation marks!
Example: Create a QR code image with the message "The quick brown fox jumps over the lazy dog" and size 200x200.
java -jar SJIT.jar -new 200x200 -newQr "The quick brown fox jumps over the lazy dog" -out newQr.png
create new QR/barcode image text: The quick brown fox jumps over the lazy dog size: 200x200 -> true processing image file: tmpImg.png file size: 895 B select image reader ... ok (com.sun.imageio.plugins.png.PNGImageReader) image type: png read image ... ok number of frames: 1 read metadata ... ok (com.sun.imageio.plugins.png.PNGMetadata) processing frame: 1/1 image type: TYPE_3BYTE_BGR image dimension: 200x200 output file: qr.png remove temp file ... ok output type is: png create iioimage ... ok select image writer ... ok (com.sun.imageio.plugins.png.PNGImageWriter) write iioimage ... ok (qr.png) output file size: 895 B ------------------------------------------------------- 1/1 processed 1 image(s) in 38 millisecond(s) total input size: 895 B total output size: 895 B (=100%) |
Troubleshooting
Problem | Solution |
---|---|
Cannot use the > or < characters on command line. |
The command for color transformation requires the syntax [sourceColor]->[targetColor] . Unfortunately the Windows command line as well as the Linux shell have a special treatment for the charater > (output redirection). That is why it needs to be escaped. On Windows with ^ ([sourceColor]-^>[targetColor] ), on Linux with \ ([sourceColor]-\>[targetColor] ). |
Cannot use spaces in texts on command line (e.g. in QR code text or EXIF content). | The same problem as with > . Normally spaces are the delimiters for command line arguments. Try to escape the spaces or to wrap the text in quotation marks ("my text" ) |
Cannot use asterisk symbol * in the input string. |
The shell/Windows command line tries to be intelligent and automatically replaces the pattern with a list of files. This leads to argument mismatches. It helps to wrap the input string in quotation marks. |
Java is missing classes from the com.sun.imageio package. |
Unfortunately the package com.sun.imageio has become deprecated in the most recent Java Runtime versions. SJIT is still using classes from this package and it will need some effort to replace it (and to test everything) with a different library. But SJIT can be run with a workaround: com.sun.imageio is still included in the latest JRE libraries, it just needs the -add-exports command to make it accessible. The entire command would be: java --add-exports java.desktop/com.sun.imageio.plugins.bmp=ALL-UNNAMED Not pretty but working... |
License
Please note: As stated in GPL SJIT comes with absolutely no warranty.
The following libraries are packed inside SJIT.jar:
- Apache Sanselan 0.97 (licensed under Apache v2.0, modified by JS): for reading/editing EXIF data and for reading images
- Apache Batik 1.11 (licensed under Apache v2.0): for reading SVG images
- Image4J 0.7.2 (licensed under GNU LGPL): for reading ICO images
- GifSequenceWriter (by Elliot Kroo): for creating GIF animations
- zxing 3.4.1 (licensed under Apache v2.0): for reading/writing QR codes/barcodes