apps-android-commons icon indicating copy to clipboard operation
apps-android-commons copied to clipboard

Transform picture (crop/rotate/etc) within the app

Open ujjwalagrawal17 opened this issue 6 years ago • 49 comments

The app should have image editing features.

Desirable features:

  • Crop (especially lossless resize à la jpegtran)
  • Rotate (90, 180, 270 degrees)
  • Modify EXIF
  • Blur faces/number plates/etc for privacy reasons (see #190)

Undesirable features:

  • Color filters such as Sajuno/Manglow/Palacia/Anax/etc (original colors are better)
  • Flip horizontally/vertically (misleading)
  • Black and white, grayscale, sepia, etc (loss of information)
  • Rescale, for instance 3000x2000 to 300x200 or vice versa (original size is the best)
  • Stickers
  • Pencil, text

Debated:

  • White balance
  • Brightness
  • HDR (sounds difficult to implement though)

ujjwalagrawal17 avatar Feb 24 '18 13:02 ujjwalagrawal17

I have been always thinking of having editing options in the app. I couldn't find image editing library that we can simply plug in the app. Am not sure how much effort we can put to write the whole editing feature by ourselves.

@nicolas-raoul would definitely have some insights on this.

maskaravivek avatar Feb 24 '18 17:02 maskaravivek

javacv library can be used for this purpose. Though I am not sure the effort needed to write the whole editing feature using this library.

tanvidadu avatar Feb 24 '18 19:02 tanvidadu

DS photo editor SDK seems to be a good option. Or do we want to develop from scratch?

Update @maskaravivek Link: https://www.dsphotoeditor.com/

knight-shade avatar Feb 25 '18 08:02 knight-shade

Can you include a link for it.

maskaravivek avatar Feb 25 '18 08:02 maskaravivek

An additional question for @nicolas-raoul ,@whym , or anyone else familiar with Commons policies - do we WANT to encourage people to edit their photos before they put them up on Commons?

Definitely no stickers or 'write' options though, please. ;)

misaochan avatar Feb 25 '18 09:02 misaochan

I believe the recommended way to do it is to have both - upload the unedited version first and then upload the edited (cropped, whitebalanced, etc) version, too, either as a separate file or by overwriting. This will allow someone else with a better editing skill to re-do the editing later, and until then the file remains as the version the uploader want it to be.

Not sure if there is a clearly spelled out policy about it, but the closest one I can find is https://commons.wikimedia.org/wiki/Commons:Overwriting_existing_files#Unedited_versions .

I don't think uploading the original is strictly required, and in practice, lots of people upload edited versions only, though.

whym avatar Feb 25 '18 09:02 whym

Yeah i agree with @whym . Even if we provide editing options in-app , I don't think that features like filters,special effects and stickers will be necessary for this app. The basic enhancements/adjustments such as brighgtness,contrast,sharpness are enough and Cropping should be given the first priority.

97balakrishnan avatar Feb 25 '18 09:02 97balakrishnan

We all seem to agree that only a subset of operations are necessary, and that some operations are undesirable, so I added them to the body of the issue, anyone feel free to modify or ask to modify.

Upload the original + overwrite with the edited version sounds like a good approach, to avoid multiplication of similar files while allowing a more skilled editor to edit the picture better later (the sad reality is that many pictures with poor white balance are used on many articles, and there are not enough Wikigraphists, so uploading only the original is not very pragmatic either).

Pros of implementing our own edition features:

  • We implement operations the safe way, for instance we can limit how much brightness gets added.
  • We don't offer undesirable features such as sepia, so users won't be tempted.

Cons:

  • Takes time to implement and maintain.
  • Bigger APK.

DS photo editor SDK can not be used as it is not open source.

nicolas-raoul avatar Feb 27 '18 06:02 nicolas-raoul

Instead of overwriting, I think that the Auto Adjust feature if available can be automatically applied if someone uploads an image.(Which automatically adjusts brightness,contrast etc). That's also a good option to be considered

97balakrishnan avatar Feb 27 '18 14:02 97balakrishnan

@97balakrishnan Would you have a link to this "Auto Adjust" feature? Or is this something that you propose to create in Wikimedia Commons?

nicolas-raoul avatar Feb 27 '18 14:02 nicolas-raoul

I suggest we can use SDKs to automatically adjust the pic before it gets uploaded to Wikimedia Commons without the intervention of the user. Something like this. https://imagizer.com/docs#auto-fix

97balakrishnan avatar Feb 27 '18 14:02 97balakrishnan

I think for now adding just crop image options would work out well. Since cropping image is an essential edit image feature in any media related application.

Jatin0312 avatar Mar 08 '18 22:03 Jatin0312

@97balakrishnan imagizer API also cannot be used as it is not open source.

In my opinion, EXIF modification and anonymization(#70, #181, #1685) would be more useful as a global setting rather than an edit option. A user who would want to remove his camera serial id from a picture would probably like to remove it from every picture. The global setting behaviour is partially implemented in #1685.

Should a new issue for EXIF modification be opened and have the issues referenced above be merged into it?

ilgazer avatar Jul 02 '18 07:07 ilgazer

In my opinion, EXIF modification and anonymization(#70, #181, #1685) would be more useful as a global setting rather than an edit option. A user who would want to remove his camera serial id from a picture would probably like to remove it from every picture. The global setting behaviour is partially implemented in #1685. Should a new issue for EXIF modification be opened and have the issues referenced above be merged into it?

I agree that global settings would be useful for anonymization. It would be good if we could have an indicator in the upload screen (ShareActivity) that that setting is on, though - as we have had issues with users enabling a setting and then forgetting that they did. :)

A new issue to discuss global settings for EXIF modification would be useful indeed.

misaochan avatar Jul 02 '18 09:07 misaochan

In my opinion, we should further reduce the scope of this edit interface to these 4 features:

  • Crop (especially lossless resize à la jpegtran)
  • Rotate (90, 180, 270 degrees)
  • White balance
  • Brightness

The EXIF editing interface should be completely seperate in my opinion. The proposed "Location data avaliable" indicator in #1687 and another indicator for "You have EXIF data for this picture" that can be clicked and open different interfaces would be more useful.

ilgazer avatar Jul 03 '18 07:07 ilgazer

"You have EXIF data for this picture" : almost all uploads have EXIF though.

nicolas-raoul avatar Jul 03 '18 07:07 nicolas-raoul

@nicolas-raoul To clarify, in my suggestion I didn't mean that the indicator would tell them whether the picture has EXIF data or not. Rather, IMO it should say something like, "Anonymization setting enabled" (if indeed the user enabled that global setting), so that people don't upload pictures forgetting that they have it on, and then complain that all their uploads have no EXIF. Alternatively, perhaps if the setting is enabled we can have an icon (mask?) that shows up on the upload screen.

I agree with the 4 features that @ilgazer proposed. For accessing the EXIF interface, perhaps we can just include that option in the expanded FAB that we already have currently (for zoom etc)?

misaochan avatar Jul 03 '18 12:07 misaochan

Note for the future: On Commons, a best practice is to first upload your unedited picture, and then overwrite it with the cropped/brightened/rotated/etc version. Benefit: if the picture becomes popular, other people can rework it, for instance rotate it differently. Having the source file means these derivatives can be of much higher quality than if the picture had been rotated two times for instance. So, we might want to do the same from the app: upload the original and then the edited version. The original should have the privacy edits applied, though, and that might in some cases include the cropping (maybe I cropped the picture because it was showing my nameplate). While we don't have to worry too much about this for this first implementation, let's keep it in mind and maybe implement it in the far future.

nicolas-raoul avatar Jan 29 '19 11:01 nicolas-raoul

a best practice is to first upload your unedited picture, and then overwrite

@nicolas-raoul So should it be like we go to the image details activity from contributions and there display an item in the menu for editing the picture.

Or

While uploading the picture just before the upload activity or just after the upload activity we can ask the user whether they would like to edit the photo?

vanshikaarora avatar Feb 24 '19 17:02 vanshikaarora

@vanshikaarora The second. In a next phase, after the user has edited the image, we may want to internally upload both the original and the edited picture, but the user would see this as a single upload.

nicolas-raoul avatar Feb 25 '19 03:02 nicolas-raoul

@vanshikaarora The second. In a next phase, after the user has edited the image, we may want to internally upload both the original and the edited picture, but the user would see this as a single upload.

@nicolas-raoul I have used the following library https://mindorks.com/android/store/Image-Croppers/arthurhub/android-image-cropper and that works pretty well for the current gradle versions.

whatsapp image 2019-02-25 at 10 38 14 pm

In case of multiple image's:

One way is to create an activity that will show thumbnail of selected images then the user can select image to edit (or even more than one, the user will be redirected back to this same activity after editing image).

@nicolas-raoul @maskaravivek Can you please pitch in your ideas :)

vanshikaarora avatar Feb 25 '19 17:02 vanshikaarora

I was thinking if we can add an edit icon in the middle section which currently has the location icon.

device-2019-02-26-000447

Clicking on the edit icon can open a separate activity(say EditActivity) where the user can crop the image and return back to this activity(UploadActivity) once done. The EditActivity can later include other edit options.

  • EditActivity can be started using startActivityForResult
  • UploadActivity can implement onActivityResult to handle edited image.

maskaravivek avatar Feb 25 '19 18:02 maskaravivek

I was thinking if we can add an edit icon in the middle section which currently has the location icon.

@maskaravivek that would definitely be better I can add the edit icon just next to location icon and that will take the user to the edit screen. :+1:

Do you agree with the current cropping library implemented or will you prefer some other one?

vanshikaarora avatar Feb 25 '19 18:02 vanshikaarora

The library looks good to me. It looks to be quite popular and is still being maintained. :)

maskaravivek avatar Feb 25 '19 18:02 maskaravivek

I was thinking if we can add an edit icon in the middle section which currently has the location icon.

@maskaravivek I couldn't find location icon in my application. Is this a difference of versions? whatsapp image 2019-02-26 at 3 25 37 pm

vanshikaarora avatar Feb 26 '19 09:02 vanshikaarora

@vanshikaarora It only shows up if your picture has latitude/longitude in the EXIF.

nicolas-raoul avatar Feb 26 '19 10:02 nicolas-raoul

@nicolas-raoul So then should the edit icon be added somewhere else on the screen or I should modify the code for showing this layout?

vanshikaarora avatar Feb 26 '19 10:02 vanshikaarora

I guess the edit icon would make that small bubble always appear? It would always contain the edit icon, but only contain the map icon for geolocalized pictures.

nicolas-raoul avatar Feb 26 '19 10:02 nicolas-raoul

I guess the edit icon would make that small bubble always appear? It would always contain the edit icon, but only contain the map icon for geolocalized pictures.

Ok then I'll work it out this way :+1:

vanshikaarora avatar Feb 26 '19 10:02 vanshikaarora

@vanshikaarora in case of multiple upload, I suggest cropping only the picture on which the user was when tapping the cropping button. If they want to crop several images, they will just press Previous/Next to reach the right image and tap again.

nicolas-raoul avatar Mar 11 '19 12:03 nicolas-raoul