[Test] Lossless rotate doesn't work

Bug #516763 reported by Stani on 2010-02-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Phatch
High
Stani

Bug Description

Hi Juho, can you provide a patch for this?

Error 0:Can not apply action Lossless JPEG on image 'IMG_8763.JPG' in folder:
/home/stani/sync/2010/woningen/verkoop/foto's

super(type, obj): obj must be an instance or subtype of type

Action:{'fields': {'All': '30%',
            'Angle': u'270 degrees',
            'Angle ': '90 degrees',
            'Bottom': '0px',
            'Copy': 'Comments',
            'Direction': 'Horizontal',
            'Direction ': 'Horizontal',
            'File Name': u'<filename>_phatch',
            'In': u'<folder>/<subfolder>',
            'Left': '0px',
            'Mode': 'All',
            'Preserve Timestamp': 'yes',
            'Right': '0px',
            'Show Advanced Options': 'no',
            'Top': '0px',
            'Transformation': u'Rotate',
            'Transformation ': 'Crop',
            'Update Exif Thumbnail': 'yes',
            'Update JPEG': 'yes',
            'Update Orientation Tag': 'yes',
            'Utility': 'Exiftran (with exif support)',
            '__enabled__': 'yes'},
 'label': 'Lossless JPEG'}

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/phatch/core/api.py", line 609, in apply_action_to_photo
    photo = action.apply(photo, read_only_settings, cache)
  File "/usr/lib/python2.6/dist-packages/phatch/actions/lossless_jpeg.py", line 261, in apply
    self.call(photo,info,utility)
  File "/usr/lib/python2.6/dist-packages/phatch/actions/lossless_jpeg.py", line 275, in call
    super(JpegUtility, self).execute(photo)
TypeError: super(type, obj): obj must be an instance or subtype of type
*

Stani (stani) wrote :
Juho Vepsäläinen (bebraw) wrote :

I don't have exiftran installed nor Ubuntu set up atm. I did glance at the code, however. You could try to replace the offending line
"super(JpegUtility, self).execute(photo)" with

        system.call(utility.get_command_line(self,photo, info['path'],
            self.get_lossless_filename(photo,info)))

and remove that part from the end of the call method. It looks a bit suspicious to me (I expect it should call exiftran/jpegtran only if provided file happens to be a jpeg, no?).

It's also curious that execute method of JpegUtility contains almost exact content as the call method of LossLessSaveUtilityMixin. If you end up doing the above change and it works out ok, you might want to eliminate JpegUtility class altogether. Utility looks like a good candidate for removal as well.

Stani (stani) wrote :

Hi Juho, thanks for looking into this. Do you have opensuse and could you install exiftran there. Unfortunately I am too busy with other parts of phatch. So a branch or a patch would be really welcome.

Thanks in advance!

Juho Vepsäläinen (bebraw) wrote :

I will look into setting up a virtual machine (Ubuntu most likely) during weekend. I don't mind if someone else wants to give proposed fixes a go, though. :)

I've just started to follow phatch development.
Your suggestions are right and they solve the problem, I modified the
code and it doesn't provoke that error anymore.

I tried to create a patch but it's the first time I use bzr, i'm
putting it in attachment, tell me if I "packaged" it correctly.

--
Andrea

2010/2/5 Juho Vepsäläinen <email address hidden>:
> I will look into setting up a virtual machine (Ubuntu most likely)
> during weekend. I don't mind if someone else wants to give proposed
> fixes a go, though. :)
>
> --
> Lossless rotate doesn't work
> https://bugs.launchpad.net/bugs/516763
> You received this bug notification because you are subscribed to Phatch.
>
> Status in Phatch = Photo & Batch!: Confirmed
>
> Bug description:
> Hi Juho, can you provide a patch for this?
>
> Error 0:Can not apply action Lossless JPEG on image 'IMG_8763.JPG' in folder:
> /home/stani/sync/2010/woningen/verkoop/foto's
>
> super(type, obj): obj must be an instance or subtype of type
>
> Action:{'fields': {'All': '30%',
>            'Angle': u'270 degrees',
>            'Angle ': '90 degrees',
>            'Bottom': '0px',
>            'Copy': 'Comments',
>            'Direction': 'Horizontal',
>            'Direction ': 'Horizontal',
>            'File Name': u'<filename>_phatch',
>            'In': u'<folder>/<subfolder>',
>            'Left': '0px',
>            'Mode': 'All',
>            'Preserve Timestamp': 'yes',
>            'Right': '0px',
>            'Show Advanced Options': 'no',
>            'Top': '0px',
>            'Transformation': u'Rotate',
>            'Transformation ': 'Crop',
>            'Update Exif Thumbnail': 'yes',
>            'Update JPEG': 'yes',
>            'Update Orientation Tag': 'yes',
>            'Utility': 'Exiftran (with exif support)',
>            '__enabled__': 'yes'},
>  'label': 'Lossless JPEG'}
>
> Traceback (most recent call last):
>  File "/usr/lib/python2.6/dist-packages/phatch/core/api.py", line 609, in apply_action_to_photo
>    photo = action.apply(photo, read_only_settings, cache)
>  File "/usr/lib/python2.6/dist-packages/phatch/actions/lossless_jpeg.py", line 261, in apply
>    self.call(photo,info,utility)
>  File "/usr/lib/python2.6/dist-packages/phatch/actions/lossless_jpeg.py", line 275, in call
>    super(JpegUtility, self).execute(photo)
> TypeError: super(type, obj): obj must be an instance or subtype of type
> *
>
>
>

Is it more useful if I upload it from the site?

Stani (stani) wrote :

Hi Andrea
The most useful is if you push your branches to launchpad:
https://code.launchpad.net/phatch
https://help.launchpad.net/Code/UploadingABranch

Note that I will be busy until march in order to review and merge it. I am really pleased with your enthusiasm. Maybe Juho can help before reviewing.

I have added you to the phatch-dev team:
https://launchpad.net/~phatch-dev

Please email the mailing list with a small introduction of yourself.

Thanks in advance!

Andrea Ambu (andreambu) wrote :

Just tried to push a branch.

Anyway I'm an Italian student (BEng in electronic engineering) who loves coding :)
I like coding in python and open source seems just a great idea to do something useful and earn some experience at the same time. I read about phatch in PyCon 2010 Atlanta website and it looks very interesting.

Oh.. as you may have noticed i'm new to launchpad and bzr but I hope to learn soon ;)

Stani (stani) wrote :

Hi Andrea,

Maybe this is more easy for you:
http://www.jonobacon.org/2010/02/10/fixing-bugs-the-opportunistic-way/

Looking forward to welcome you in the team!

Nadia Alramli (nadiana) wrote :

Hi Andrea,

Welcome to the team :)

- Nadia

Stani (stani) on 2010-02-21
Changed in phatch:
milestone: 0.2.6 → 0.2.7
Stani (stani) on 2010-02-23
summary: - Lossless rotate doesn't work
+ [Test] Lossless rotate doesn't work
Stani (stani) on 2010-02-24
Changed in phatch:
assignee: Juho Vepsäläinen (bebraw) → Andrea Ambu (andreambu)
status: Confirmed → In Progress
Stani (stani) wrote :

Hi Andrea,

The code needed a bit more clean up as suggested by Juho:
http://bazaar.launchpad.net/~stani/phatch/trunk/revision/1591#phatch/actions/lossless_jpeg.py

Thanks very much for your effort anyway. I really appreciate it!

Changed in phatch:
assignee: Andrea Ambu (andreambu) → stani (stani)
status: In Progress → Fix Committed
Stani (stani) on 2010-03-17
Changed in phatch:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers