[Solved] Lossless JPG Cropping?

I'm looking for a simple tool to crop and flip/rotate jpg or jpeg images losslessly.
Most probably some sort of jpegtran frontend.
It can be command line, but a simple gui would be nice.
Another feature I want would be overwriting the original.
jpegtran itself would require 3 commands for every image: it doesn't get the logic right when I crop AND flip, so I need to do that in 2 commands, and then i need to force move the new file back onto the original.
I have investigated this, and came up with (and discarded):
- cropgui and cropgtk (I cannot enter a fixed ratio. It's very hard to drag the selection pixel-precise, and it changes by a few pixels every time I move it. It doesn't have flip/rotate. It doesn't overwrite originals)
- ljcrop (would seem to suit my needs but hopelessly outdated? I actually managed to find the file here but it's not running, missing the Tcl Img package)
- viewnior is simple and has all the functions but i cannot get any information on how it performs cropping/flipping/rotating and whether it is lossless)
I have tried a few more, mostly from this list.
Last edited by ondoho (2014-04-26 19:19:50)

emeres wrote:What about running Jpegcrop with wine or any other of the windows software listed? (that list is long) Works fine for me, however it is an another frontend for jpegtran.
Appreciated, but i'm not installing wine for that.
anyhow, i have done some reading on lossless jpeg crop/rotate, and there are some limitations that are set by jpeg's compression itself.
this kind of brings down my whole idea, because i need to crop areas of the exact same dimension out of many different jpg images, and that exactly is not possible losslessly. at least not pixel-precise.
otherwise, cropgui is a great tool.
emeres wrote:By the way, how do you determine there is lossless cropping? Technically you would have to compare bytes of the original and cropped section.
i trust the documentation.
also, if the saved cropped files size is larger than the original, or i get an extra dialog asking what quality i want to use, my guess is it's not lossless.
i'm marking this solved now. should have probably done that earlier.

Similar Messages

  • How to perform lossless JPG rotation?

    If I rotate a JPG 90/180/270 degrees in Preview or iPhoto or Aperture, will it be a lossless rotation? If not, are there plugins or third party apps that can?

    g-pod:
    iPhoto does lossless rotate. You can check it out by rotating a photo and then dragging it to the desktop. Check the size in the Finder and drag it into an open Safari window do confirm that it has been rotated. Safari does not read the orientation tag so it's a good test.
    Happy New Year
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • SOLVED: inaccurate JPG previews in Bridge

    Just wanted to share my success story in case this helps somebody. I normally shoot RAW, and I convert to JPG with ACR and Photoshop. For a long time I've been aggravated that my JPG images often are incorrect in Bridge thumbnails or previews. While sometimes they are spot on, they frequently have dramatic changes in contrast or brightness. The brightness issue is particularly aggravating because the images typically get too bright, and highlights get blown out.
    Just to clarify what I mean by "incorrect", I mean that the exact same JPG files look perfect when opened in Photoshop, Windows Explorer, or any other 3rd party application. I was only seeing the shift in brightness/contrast inside Bridge. High-quality thumbnails were turned on in Preferences, too, so quality was not the problem. I basically had given up and resorted to using Photoshop, Explorer, a web browser, or other tools to judge the final quality of my JPGs.
    I knew the problem was not a figment of my imagination today when an out-of-the-camera JPG file that was HEAVILY underexposed (intentionally) appeared in Bridge looking perfectly bright.
    So that inspired me to dig deeper and solve the problem. My Bridge preferences had "Prefer Adobe Camera Raw for TIFF and JPEG Images" enabled. My ACR defaults include the "auto" setting for exposure. So ACR was actually generating the previews for my JPG files, rather than Bridge. And in the process, it was resetting the images to what it thought was the correct auto exposure!
    By disabling "Prefer Adobe Camera Raw" and clearing my cache, all my previews and thumbnails have gone back to being perfect - exactly what is contained in the JPG file. What a relief!
    By the way, this was all in CS3, but I had the same problem in the CS4 trial. Presumably the same solution works in CS4.
    Hope this helps somebody out there. I realize this issue has probably been covered in this forum before but I couldn't find it in search results.

    Don - well first, just to reiterate, it was never my intent to use ACR whatsoever for processing my already-processed JPG files. As to using "auto" as a default for my RAW file processing, I do it because it minimizes the amount of tweaking I need to do subsequently. I virtually never leave the settings untouched, but I find auto is a convenient starting point.
    Exposure: auto usually agrees exactly with where I would be setting it (which is normally 0 unless I botched the exposure on the shot.. if auto doesn't say 0 I take a careful look at why).
    Contrast: I actually tend to like the auto contrast ACR comes up with and don't change it on too many of my shots.
    Black point: again, almost always ACR sets it exactly where I would have. Sometimes it is willing to clip a little more black than I would like, so I scale it back.
    Brightness: I usually hate ACR's auto brightness so I change this on virtually all of my photos and pull it down quite a bit. However, there is no "standard" setting that is correct for all my photos, so as far as I'm concerned, "Auto" is as good a bet as anything as a starting point.
    Am I working inefficiently? What would you recommend I do for my ACR defaults on that tab?
    (sorry this is getting off-topic from the original post...)

  • How to batch convert pdf to jpgs, crop to trim and save?

    I'm trying to figure out how to take a couple of hundred PDFs, Crop them to trim, then convert them all to JPGs using any of the adobe programs.
    In bridge I was able to Batch convert all the PDFs to JPGs but it wouldn't crop them to the trim also...
    I thought I could use the Photoshop Image Processor to batch action crop and save them again but I always get one of two errors... "There were no source files that could be opened by Photoshop." or "Please Specify a destination folder."
    I don't know why this is coming up since I have it selecting the folders with the JPGs that I converted in Bridge and saving to another folder..
    Does anyone know if I can do all of this at once? Or how I can somehow get this to work so that II don't have to open,crop and save for each individual file?

    Corel's WP has not / does not use anything of Adobe's to create PDFs.
    With Acrobat installed you can "file - print" WP files to the Adobe PDF virtual printer that is installed with Acrobat.
    Perhaps an OS based "batch" printer job would be possible. Something for you to look into.
    As well, if you have WP installed there may be something WP can do.
    To learn of such you'd want to visit Corel's WP customer support.
    Be well...

  • Lossless JPG rotation with Preview?

    If I rotate a JPG in Preview, will it be a lossless rotation?

    I had my question answered here: http://discussions.apple.com/message.jspa?messageID=6233761
    Thanks for directing me to that part of the forum.

  • [SOLVED] How to Crop an MP4 Video via Command-line?

    I have ffmpeg, mpg123, and mencoder. Does anyone know of a way I could use any of those to crop an mp4 video via command-line? I am trying to take off the black space above and below a video. Thanks in advance!
    Last edited by tony5429 (2009-04-12 00:12:57)

    I don't think it's possible to crop without re-encoding, but you can crop from the command line with ffmpeg and mencoder. Not sure about mpg123 - I think that's for playing audio but I could be wrong there.
    Anyway, with ffmpeg you can do cropping by using -croptop, -cropbottom, -cropleft, and -cropright. So if you wanted to crop 16 pixels off of the top and the bottom, your command line would look something like this:
    ffmpeg -i <input file> -croptop 16 -cropbottom 16 <video encoding options> <audio encoding options> <output file>
    With mencoder you use the "crop" video filter, like this:
    mencoder <input file> -o <output file> -vf crop=320:208:0:16 <other options>
    where the "320:208:0:16" means that the resulting picture is 320 pixels wide, 208 pixels high, and the 0:16 is the x,y position of the cropped area.
    These command lines are just really very basic examples - ffmpeg and mencoder have a LOT of options. Way too many to explain here. If you don't believe me, just try reading through the mencoder man page sometime. (There's an online version of it at: http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html)
    Hope this helps!!

  • Cropped a jpg and did a "ctrl s" to save it but everytime I do, it wants to save as a .PSD, why?

    Trying to crop a couple of hundred images.  Was using CS2 to do it but then I thought why not use CS6 to do it.  Opened a jpg, cropped it the way I wanted and did a ctrl s to save it, only to find it wants to save it as a psd.  Not cool.

    Perhaps it's because you may not have "Delete Cropped Pixels" checkmarked if you use the Crop Tool in CS6.
    Your background layer then turns into Layer 0, a floating layer, and cannot be saved as a jpeg, so PS saves it as a psd, becattuse that format supports floating layers.
    How, where would one do that?  Checkmark the "delete cropped pixels"?  My background layer is turning to a Layer 0.
    Thanks!

  • Unable to Open Lossless JPEG Image

    Hi,
    I have jdk 1.6.0. and i installed the jai-Imageio pakage.i am not able view the true lossless jpeg
    image.
    I tried to open a lossless jpeg image from the code given in
    http://forums.sun.com/thread.jspa?forumID=20&threadID=335960
    but the
    image does not open. It works for jpeg, jpeg2000 images. but not
    lossless jpeg and jpeg-ls images..
    when i try to code
    String s[] = ImageIO.getReaderFormatNames();
    for(int i=0;i< s.length ;i++)
    System.out.println(s);
    it prints
    raw
    BMP
    JPEG2000
    RAW
    jpeg
    tif
    jpeg2000
    WBMP
    GIF
    TIF
    TIFF
    jpg
    bmp
    PNM
    JPG
    pnm
    wbmp
    png
    JPEG
    PNG
    jpeg 2000
    JPEG 2000
    gif
    tiff
    if i try to load lossless jpeg image it shows the exception that
    but when i write code like
    CLibJPEGImageReaderSpi cl = new CLibJPEGImageReaderSpi();
    String s[] = cl.getFormatNames();
    for(int i=0;i< s.length ;i++)
    System.out.println(s[i]);
    it prints
    jpeg
    JPEG
    jpg
    JPG
    jfif
    JFIF
    jpeg-lossless
    JPEG-LOSSLESS
    jpeg-ls
    JPEG-LS
    if i check with 'cl.canDecodeInput(imageInputStream)' it returns true.
    i d't now how to load the image using 'CLibJPEGImageReaderSpi' class object
    or is there any other way to load the image ?
    can anybody write the full code to display the true lossless jpeg image
    which is taken from dicom medical images. the images are available at
    http://rapidshare.com/files/250911269/Lossless_jpeg.zip.html
    is there any website has good tutorial about lossless jpeg image. what
    is point transform in lossless jpeg ? what old pseudo lossless jpeg ?
    what is equivalent for that in java ?

    There are two images in that zip file. I have no problems reading the one called "lossless.jpg". It's a 16-bit grayscale image that's completely black. The one called "test.jpg" throws an exception. Is this what you're getting? I'm using JAI-ImageIO 1.1
    is there any website has good tutorial about lossless jpeg image. what
    is point transform in lossless jpeg ? what old pseudo lossless jpeg ?
    what is equivalent for that in java ? In addition to describing normal jpeg encoding, the jpeg specification also describes what's called "lossless jpeg" encoding. Lossless jpegs - as described in the original specification - are obsolete. No common application can open them. It doesn't help that the png format (also lossless) provides much smaller file sizes then lossless jpeg's.
    Both of the jpegs in that zip file are lossless jpegs. Incidently, I can't open them up with Irfanview or Adobe Photoshop CS4 (wich says alot). And I can only read "lossless.jpg" with JAI-ImageIO while the other one throws an IOException. By using lossless jpegs, the user cripples portability.
    JPEG-LS is different from lossless jpeg. In fact, it was meant to replace lossless jpegs. While not actually lossless, jpeg-ls is described as a "near lossless" compression. I believe the files have a +.jls+ extension instead of a +.jpg+ one. While not obsolete (I think), JPEG-LS is not widely used. Using it can still cripple portability.
    The JPEG2000 format also has a "lossless" mode, that again, is not widely used. Using it can still cripple portability. JPEG2000 files have a +.jp2+ extension.
    Lastly, I don't know what you mean by this question
    what is point transform in lossless jpeg?PS: I have no problems reading a lossless jpeg or a jpeg-ls that I write with JAI-ImageIO. So maybe there's something wrong with "test.jpg" in the zip file?

  • CS3 crash when opening JPG (rotated in Irfanview)

    I just recently bought a new computer, so I thought I could at last use Photoshop CS3, but apparently it does not like jpg's that are rotated (with lossless jpg conversion) in Irfanview.
    Until this point every file works, even those jpg's which are not rotated.
    The error report can be seen here: http://oranse.kapsi.fi/cs3error.txt
    Are there any suggestions for a solution or workaround?
    [EDIT]
    OK, I can now open the images via Camera RAW.
    But I still consider this as an issue, although not a severe one, because I intend to shoot everything on RAW from now on. But there are still tons of old photos on JPG to be postprocessed.

    That isn't necessarily a solution since "lossless" operations on jpegs is
    something of a misnomer. All it means is that they are not recompressed. To
    quote the Irfanview help file:
    "Note: Lossless JPG operations like flip or rotate work only if the image
    height is a multiple of 16 (JPG specification). If this is not the case,
    unused image lines will be removed.
    Note: Your original JPG file will be changed/overwritten!"
    As far as I can tell, the same applies in all programs offering jpeg
    lossless transformations.
    Trez

  • Improve auto-import for tethered capture...

    Simply add an option to have new images automatically inherit the develop settings of the previous image (all settings including crop).
    Currently, when shooting tethered, I capture and adjust an image - but before I can go back to camera I need to create a new develop preset and point to it in auto-import settings (simply re-saviing the current preset doesn't work). However, this doesn't consistently hold the crop -- and so much commercial work is shot to a specific layout or proportion. Instead, I rely on the previous and/or sync function. Ideally, there would be a way to know that the new images would easily auto import with the same look as previous photos.
    Thanks,
    Andy

    This would be more readily solved by adding crop to develop presets, which is useful for other purposes also.

  • Some Canon CR2 RAW Files Will Not Open In Elements 8

    I use a Canon 7D DSLR.  Up until 30 minutes ago I never had a problem opening Canon CR2 RAW files in Photoshop Elements 8.
    Some files still open others do not.  I can think of only one thing.  I was shooting a large number of frames and reduced the RAW Image size down from RAW Large Only to RAW Medium with Small Jpeg to give me more room on the Compact Flash Card.
    The Large RAW only CR2 files open fine in PSE 8, the Jpegs open fine, but the smaller sized CR2 files will not open and I get a wrong file type message in PSE8.
    Any ideas why this would happen?  I suspect it is a function of the camera setting, but all RAW files download as CR2 files.
    I appreciate any guidance in this matter.  Needless to say I am resetting my camera back to Large RAW files only.
    Alex

    ACR 5.x only supported full-sized 7D RAWs, but ACR 6.x supports 7D mRAW and sRAW, so just update to the latest version of the plugin, following the PSE-specific instructions:
    http://www.adobe.com/downloads/updates/
    sRAW and mRAW files are not RAWs because the camera has already demosaicked them to RGB and encoded them as lossless JPG.
    Here is technical information on the reduce-sized RAWs:
    http://lclevy.free.fr/cr2/#sraw

  • Youtube reply button in comment section does not work

    As of today the "reply" button in the comment section on any youtube video has stopped working, Usually it brings up an input field when clicked, but now I get nothing except a blue glow around the button [http://i259.photobucket.com/albums/hh299/Viruzzz_bucket/Untitled-1.jpg (cropped picture of what I see)]
    So far I have attempted the following with no success
    *restarting firefox
    *restarting the computer
    *reinstalling latest version of flash
    The button works if I access a video page through internet explorer, but I despise that browser.

    What's even more crap about this is your old posts are not updated with your name. So new reply posts look like (on first glace without a user clicking on the user name of old posts vs Real name of new posts to see they are the same) that the posts are coming from two different users. Just messy all the way around... and frustrating that I cannot continue my convos today without surrendering my privacy.

  • Files get corrupted in Lightroom 4, through 4.4

    So I was going to comment on one of the other posts about the corrupted files but it was soooo long I decided to start a new one.
    This should give me a hint that it is not HARDWARE....
    To start with I am shooting a Canon 5d mkIII and RAW(.CR2) files
    A slight kink in everyones generic answer that it is a hardware issue; I reproduced this on two computers using the same .cr2 files copied from the same original downloaded files.  Lightroom corrupted files on import on both computers.
    Also to test the answer it was corrupt before it went into Lightroom.  I always copy the raw .cr2 file to my laptop and then to a external drive from the laptop directory, not from the compact flash.  I looked at a .cr2 file with Photoshop and it was fine.  Then I imported that same file with all of the other .cr2 files in the directory into Lightroom 4 and it was corrupt along with many others. 
    My disappointment is that when I tried to open the same .CR2 file, that was fine a moment earlier with Photoshop, it too was corrupted.  I thought Lightroom was non-destructive to the original file.
    I deleted that .cr2 file and restored the backed up file that was a copy of the original and imported that single file into Lightroom and it was now fine.
    Sorry but not acceptable.

    Replying to myself:
    I digged into some reverse-engineered CR2 specifications on the net and found 5 things:
    Canon uses a lossless compression in their CR2 files. So that suspicion was confirmed.
    The algorithm does not seem to have changed substantially in later models. So that suspicion was not confirmed.
    Before doing the compression, the raw photo is divided into vertical slices. Usually 2 or 3 slices, it seems, though I am not sure). This seems to explain why we sometimes see a corrupt lower quadrant of a Canon photo.
    According to one source, the image is "interlaced" before compression, so all lines with RG information are kept together, as are all lines with GB information. Based on that, I would expect to see photos with every second line corrupted, if we could see the photo prior to demosaicing. But since we only see the photos after demosaicing (which involves combining information from several lines), that is not really relevant.
    The compression algorithm used is Lossless JPG which uses Huffmann encoding for compression. This seems to me like a method which has good corruption potential.
    The long version of my reasoning for the corruption potential of Lossless JPEG + Huffman encoding (just skip it if it is too boring):
    I have heard about Huffman encoding many times before, but I have never bothered to find out how it works. This thread was a good reason to bother, so I finally did it.
    Lossless JPEG works by predicting the value of each pixel based on the pixels above it and to the left of it. The difference between the actual pixel value and the prediction is then stored as a prediction error. The original pixel values can then be thrown away because the raw decoder can precisely reconstruct them from the prediction errors and knowledge of the prediction method used.
    This means that it is only necessary to store the prediction errors in the file. Even though the original pixel values will be very different, a lot of pixels will have the same prediction error (close to zero). This makes it easier to compress the prediction errors than the original pixel values.
    The prediction errors are compressed using Huffman encoding which works sort of the same way as international dialing prefixes (this is a comparison I have come up with myself):
    There are more than 100 countries in the world, so we sometimes have to use a 3 digit prefix. But we don't use 3 digit prefixes all the time. For example, USA is +1 and Denmark is +45. So when you punch for example '+4512345678', how does the phone system know that the international prefix part of the number is exactly +45 and not +4 or +451?
    The answer is that one international prefix is never used as the first digits in another international prefix. So +10, +11 ... +19 and +100, +101 ... +199 are never used as international prefixes because USA already have used +1, and +451, +452 ... +459 are never used because Denmark have already used +45.
    Huffman encoding works in the same way. Instead of having a lookup table with dialing prefixes of different length and their corresponding countries, it has a lookup table of bit codes of different length and their corresponding prediction error. Each bit code can never be used again as the beginning of a longer bit code so the encoder will always know where one bit code ends and the next begins, even though they are of different length.
    This means that the well predicted pixels can be stored with just a few bits instead of storing them as a full 14 bit value. Just like USA can be dialed with +1 instead of using full 3 digit code of +001.
    But it also means that decoding will fail miserably if just one bit is switched. Switching one bit in a bit code will usually mean that the length of that bit code will be misinterpreted, and that means that the decoder will look for the start of the next bit code in the wrong place. So from that point in the bit sequence, we can expect everything to go wrong.
    (Sorry to be so long winded. But reading about Huffmann is like getting a new tool - I just have to use this knowledge for something.)

  • Lightroom 4.1(64bit) loss of sharpness

    Hi,
    I have converted to jpg some .nef from my D800 with Lightroom 4.1 at max sharpening, 150, with Capture NX 2.3.4 with max sharpening set in picture style settings only and ViewNX2 2.5.1 with max sharpening set in picture style only. Have played with other settings in "details box" of LR4.1, radius, details and masking, but the result is about the same. Please, look at this two photos, converted with CaptureNX 2.3.4 and LR 4.1: at bottom the loss of details is noticeable(the palm, the street lamp). With ViewNX2 have the same result.
    Fortunately, it does not happen with all the photos, but happens. Happens in particular with the dark photos and night shots. Please note, that it is not a matter of contrast.
    Converted with LR 4.1, only sharpening and camera setting picture style:
    http://i46.tinypic.com/11v6x68.jpg
    CROP LR 4.1 100%
    http://i48.tinypic.com/5zptlw.jpg
    Converted with CaptureNX, only sharpening and camera settings picture style:
    http://i47.tinypic.com/2exbtbs.jpg
    CROP CaptureNX:
    http://i49.tinypic.com/28guqz6.jpg
    Converted with LR 4.1, only sharpening, camera setting picture style and contrast +30:
    http://i49.tinypic.com/2qvfa7c.jpg
    CROP LR 4.1 with contrast +30:
    http://i50.tinypic.com/2wgg60z.jpg
    Thanks for your time
    Best Regards
    Excuse me for my bad English

    Hi Jeff,
    already do it, but unfortunately the result is about the same rather, is the same.
    I don't know why other minor software are better in sharpness.
    Thanks anyway
    Best Regards
    Excuse me for my bad English

  • How to import RAW + Adobe Camera Raw settings to iPhoto?

    Hi folks,
    I'm trying to import into iPhoto RAW files (Canon .CR2) that I have adjusted in Adobe Camera Raw (ACR).
    The problem is that, iPhoto is not picking up the ACR adjustments that are contained in the side-car .xmp file; it's just showing the RAW file 'as-shot'.
    For example, if the RAW file's white balance is off, and I correct it in ACR, then, once imported, iPhoto shows the image with the 'incorrect' white balance, as if I hadn't corrected it at all.
    Can anyone confirm if this is the correct behaviour of iPhoto?
    Is there any way to have iPhoto take the ACR adjustments into account?
    I'd be grateful for your help.
    Regards,
    Ken.
    P.S.  I think I have iPhoto '09—it's the immediate predecessor of the very latest version that was released fairly recently.

    This is the correct behaviour. iPhoto will understand the RAW file from the camera, but it will not handle ACR adjustments. If you want to deal with the pic in iPhoto, you'll have to render it to an image format first. You can maintain quality by using a lossless format (.tif, lossless jpg).
    That may not be ideal. If so, and you need image editing on the ACR file, Lightroom is probably your best bet

Maybe you are looking for