Re: Lossless jpeg cropping



On Mon, 2006-05-15 at 21:05 +0200, Anders Bo Rasmussen wrote:
> On Mon, May 15, 2006 at 01:20:41PM +0200, Stephane Delcroix wrote:
> > Hi all,
> > 
> > I've worked on this during my honeymoon: adding lossless cropping for
> > jpeg in f-spot.
> > 
> > Get the patches from http://bugzilla.gnome.org/show_bug.cgi?id=339081
> > 
> > The first patch (libs and API) is ok and works well. The second one is
> > only a way to show and test that new functionality.
> > 
> > I don't want to make a clear and neat UI binding before having some
> > feedbacks on lossless jpeg cropping from the list:
> > 
> >  * Do you think it is useful ?
> 
> This is for me the most important missing feature. At the moment I have
> to start a program in Wine to do it (I only do it for small posters
> since it is too time consuming).
> 
> >  * The X and Y offsets must be aligned with jpeg blocks (i.e. multiple
> > of 8). The user should know whether the results of his cropping will be
> > as requested. What about breaking aspect ratio constraints ?
> 
> First of all I don't think the user selects the excat pixel where he
> wants to cut. Digital cameras has more pixels than a screen.

Yeah, I think the same...

> 
> What happens if it is not on a multiple of 8? Do the image only loose
> quality in the blocks that is next to a border? If so I think it would
> suffice if it was possible to set the image quality of these blocks to
> 100. If that is not possible with this library, it is probably too much
> work, to not work around it.
> 

If the selection is not aligned (left and top) on jpeg blocks, the
library lower the offsets to fit.
i.e.: 
requested 
  x-offset: 1030
  y-offset: 511
  width: 900
  height: 800
=>
cropped
  x-offset: 1024
  y-offset: 504
  width: 906
  height: 507

The solution proposed is not only too much work. I think it's not
possible at all. It implies rewritting all the blocks and then, it's
lossy

> I can se the following solution, if the above is not possible:
> 
> If the user has selected that he wants lossless cropping, the UI
> could restrain the selection to allowed places. So when the user draws
> the box he wants to cut it will only appear where it is possible to cut. 

I guess it's the easiest solution to respect the aspect ratio.
Otherwise, the cropping library also need to know the aspect ratio, do
some maths... and it's out of the scope of jpegtran.

rgds,

Stephane

-- 
Stephane Delcroix
stephane delcroix org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]