I have an image and it's a jpg.
I tried running through jpegtran with the following command:
$ jpegtran -copy none -optimize image.jpg > out.jpg
The file outputs, but the image seems un-modified (no size change)
I tried jpegoptim:
$ jpegoptim image.jpg
image.jpg 4475x2984 24bit P JFIF [OK] 1679488 --> 1679488 bytes (0.00%), skipped.
I get the same results when I use --force with jpegoptim except it reports that it's optimized but there is no change in file size
Here is the image in question: http://i.imgur.com/NAuigj0.jpg
But I can't seem to get it to work with any other jpegs I have either (only tried a couple though).
Am I doing something wrong?
I downloaded your image from imgur, but the size is 189,056 bytes. Is it possible that imgur did something to your image?
Anyway, I managed to optimize it to 165,920 bytes using Leanify (I'm the author) and it's lossless.
Related
I've been looking for a solution to perform the equivalent of magick -auto-level in ffmpeg but am unable to find anything. There are some references stating I should first manually discover the levels using other software like GIMP, however, I'm looking for an automated and simpler solution. Any ideas how to address this?
I've tried the following - the first enhanced the image which was initially prettry dark, but the second over-exposed it, causing it to become mostly white:
convert img.jpg -auto-level img2.jpg
ffmpeg -i img.jpg -vf "normalize" -y img2.jpg
Note: I apologize I cannot share the image as it is restricted by privacy policy
So I have raw image and I am just curious If I can edit such image to save as RGB-32 Packed transparent interlaced raw and what program I could use, there is specification:
Format of RAW image
I have tried using photoshop but then game crashes. Is it even possible? I should get file without thumbnail. I also tried using gimp, free converters and Raw viewer but no luck. Any suggestions?
Edit:
Used photoshop (interleaved with transparency format), game starts but images are just bunch of pixels.
file that i try to prepare (221bits)
We are still not getting a handle on what output format you are really trying to achieve. Let's try generating a file from scratch, to see if we can get there.
So, let's just use simple commands that are available on a Mac and generate some test images from first principles. Start with exactly the same ghost.raw image you shared in your question. We will take the first 12 bytes as the header, and then generate a file full of red pixels and see if that works:
# Grab first 12 bytes from "ghost.raw" and start a new file "red.raw"
head -c 12 ghost.raw > red.raw
# Now generate 512x108 pixels, where red=ff, green=00, blue=01, alpha=fe and append to "red.raw"
perl -E 'say "ff0001fe" x (512*108)' | xxd -r -p >> red.raw
So you can try using red.raw in place of ghost.raw and tell me what happens.
Now try generating a blue file just the same:
# Grab first 12 bytes from "ghost.raw" and start a new file "blue.raw"
head -c 12 ghost.raw > blue.raw
# Now generate 512x108 pixels, where red=00, green=01, blue=ff, alpha=fe and append to "blue.raw"
perl -E 'say "0001fffe" x (512*108)' | xxd -r -p >> blue.raw
And then try blue.raw.
Original Answer
AFAIK, your image is actually 512 pixels wide by 108 pixels tall in RGBA8888 format with a 12-byte header at the start - making 12 + 4*(512 * 108) bytes.
You can convert it to PNG or JPEG with ImageMagick like this:
magick -size 512x108+12 -depth 8 RGBA:ghost.raw result.png
I still don't understand from your question or comments what format you actually want - so if you clarify that, I am hopeful we can get you answered.
Try using online converters. They help most of the time.\
A Website like these can possibly help:
https://www.freeconvert.com/raw-to-png
https://cloudconvert.com/raw-to-png
https://www.zamzar.com/convert/raw-to-png/
Some are specific websites which ask you for detail and some are straight forward conversions.
I have jpegoptim version 1.2.3, and PageSpeed Insights says that I can reduce my image by 36,6 KB (95 %). But using jpegoptim image.jpg --strip-all
image.jpg 147x196 24bit JFIF [OK] 39227 --> 39227 bytes (0.00%), skipped. does nothing.
jpegoptim could not compress lossless your image, you could add --max=60 to force lossy compression.
A lot of online JPEG optimizers (compressjpeg.com, tinyjpg.com) use lossy compressions.
I ran the image through Compress JPG and reduced it to 12K.
I was trying to use the convert command (OS X El Capitan) to convert a .mod video to .mp4 and it quickly filled up my disk space and I had to Control + C to halt it.
But after restart, the disk space is still filled and I don't know where the cache, i.e. the half converted video is and I don't know how to delete it. Can anyone help?
Thank you!
If you have set either of the two environment variables:
MAGICK_TEMPORARY_PATH
MAGICK_TMPDIR
then ImageMagick will use that directory for its temporary files. So, the first way to check is to run
env | grep -i MAGICK
and see if you have either set.
Failing that, or if you have no environment variables set, the easiest way I know to find where ImageMagick caches on disk is to turn on cache debugging and force ImageMagick to go to disk. So, we can turn on cache debugging with:
convert -debug cache ...
and we can force ImageMagick to go to disk by limiting the RAM it is allowed to use with:
convert -limit memory 100k ...
So, if we put that together:
convert -debug cache -limit memory 100k -size 1000x1000 xc:gray image.jpg
2016-05-19T13:25:46+01:00 0:00.000 0.000u 6.9.4 Cache convert[46510]: cache.c/SetPixelCacheExtent/3500/Cache
extend gray[0] (/var/tmp/magick-46510CYSKWOdhlrym[3], disk, 8MB)
2016-05-19T13:25:46+01:00 0:00.010 0.000u 6.9.4 Cache convert[46510]: cache.c/OpenPixelCache/3776/Cache
open gray[0] (/var/tmp/magick-46510CYSKWOdhlrym[-1], Map, 1000x1000 7.629MiB)
And, if you look carefully, you can see it is using /var/tmp on my Mac OSX - your system may be different, but this technique should show you what it is using.
Just as a test, I can set an environment variable and check ImageMagick is using it:
# Tell IM where to cache stuff on disk
export MAGICK_TEMPORARY_PATH=/tmp/TEMPPATH
# Force an operation that will require caching
convert -debug cache -limit memory 100k -size 1000x1000 xc:gray image.jpg
2016-05-19T14:09:51+01:00 0:00.000 0.000u 6.9.4 Cache convert[46584]: cache.c/SetPixelCacheExtent/3500/Cache
extend gray[0] (/tmp/TEMPPATH/magick-46584CivsEmIPjwv2[3], disk, 8MB)
2016-05-19T14:09:51+01:00 0:00.010 0.000u 6.9.4 Cache convert[46584]: cache.c/OpenPixelCache/3776/Cache
open gray[0] (/tmp/TEMPPATH/magick-46584CivsEmIPjwv2[-1], Map, 1000x1000 7.629MiB)
Keywords: ImageMagick, environment variables, tmp, TEMPDIR, TEMPPATH, cache, disk, cache
How can I determine the bit depth of a bmp file on Mac OS X? In particular, I want to check if a bmp file is a true 24 bit file, or if it is being saved as a greyscale (i.e. 8 bit) image. I have a black-and-white image which I think I have forced to be 24 bit (using convert -type TrueColor), but Imagemagick gives conflicting results:
> identify -verbose hiBW24.bmp
...
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
> identify -debug coder hiBW24.bmp
...
Bits per pixel: 24
A number of other command-line utilities are no help, it seems:
> file hi.bmp
hi.bmp: data
> exiv2 hiBW24.bmp
File name : hiBW24.bmp
File size : 286338 Bytes
MIME type : image/x-ms-bmp
Image size : 200 x 477
hiBW24.bmp: No Exif data found in the file
> mediainfo -f hi.bmp
...[nothing useful]
If you want a commend-line utility try sips (do not forget to read the manpage with man sips). Example:
*terminal input*
sips -g all /Users/hg/Pictures/2012/03/14/QRCodeA.bmp
*output is:*
/Users/hg/Pictures/2012/03/14/QRCodeA.bmp
pixelWidth: 150
pixelHeight: 143
typeIdentifier: com.microsoft.bmp
format: bmp
formatOptions: default
dpiWidth: 96.000
dpiHeight: 96.000
samplesPerPixel: 3
bitsPerSample: 8
hasAlpha: no
space: RGB
I think the result contains the values you are after.
Another way is to open the image with the previewer preview.app and the open the info panel.
One of the most informative programs (but not easy to use) is exiftool by Phil Harvey http://www.sno.phy.queensu.ca/~phil/exiftool/ , which also works very well on MacOSX for a lot of file formats but maybe an overkill for your purpose.
I did this to investigate:
# create a black-to-white gradient and save as a BMP, then `identify` it to a file `unlim`
convert -size 256x256 gradient:black-white a.bmp
identify -verbose a.bmp > unlim
# create another black-to-white gradient but force 256 colours, then `identify` to a second file `256`
convert -size 256x256 gradient:black-white -colors 256 a.bmp
identify -verbose a.bmp > 256
# Now look at difference
opendiff unlim 256
And the difference is that the -colors 256 image has a palette in the header and has a Class:PseudoClass whereas the other has Class:Direct