When working with images, it’s very useful to have a “Reset” button to restore your image to its original condition. Currently we can only restore resized images with “Original Size”. A much more useful command would allow you to completely restore an inserted image to its original state. This would undo everything including resizing, rotating, scaling, cropping and framing with lines.
Unless someone can come up with a compelling, common use-case, I see no reason for “Reset Image” to not replace “Original Size” in the context menu.
This is really two things in one:
1) make an entirely new uno command;
2) Replace the reset image with said uno command
I have no opinion as to #2 (UX needs to deal with that). First point makes sense. Marking as new and setting as an enhancement
I think Original Size shouldn't be replaced with Reset Image. It is good idea. I've started to work on. Thank you for reporting and letting me know.
Still working on and i've sent a patch for it:
How can I test this after applying the patch? Since this is more useful superset of uno:OriginalSize, could you remap it to use your new command for testing and evaluation? If we don’t a replace the "Original Size" context menu option, we should create a “Reset” button in the sidebar.
This needs a lot of discussion on what is intended and if we can actually reasonably provide it. See my comment on patchset 4 at https://gerrit.libreoffice.org/#/c/26757/4 ... => NEEDINFO
> I dont think we want to inflate files by storing both the original and the modified images (people might also find it surprising that their original image contents are "leaked").
The purpose of this function is to restore an inserted image by resetting all attributes like rotations, cropping, scaling, etc back to their default values. So we shouldn't have store a copy of the original or use the undo stack. Currently you can manually undo a cropping after saving, so this function should also be able to work after a save+close(the original data must be stored somewhere). After rotating an image, you can manually, rotate it back to 0 degrees, so this reset function should also be able to do this.
Other office suites like WPS Office and MS Office have an image reset function. So a user coming from other suites trying to use "Original Size" to fix a cropping error, ends up thinking our software is buggy.
In the cases where our image manipulation is destructive, like rotating in writer, I'd rather see them made non-destructive(see Bug 73797) and have their rotation values reset to default. Impress and Calc should just be able to set the rotation angle back to their default value of 0.
This is your area of expertise. Do you have any feedback?
(In reply to Luke from comment #6)
> The purpose of this function is to restore an inserted image by resetting
> all attributes like rotations, cropping, scaling, etc back to their default
Hmm, in a limited way that might work. That would mean to reset the AttrSet (e.g. the stuff that happens at grfsh.cxx:651):
GetShell().SetAttrSet( aGrfSet );
> So we shouldn't have store a copy of the original
> or use the undo stack
No. This need to be undoable. Otherwise, if you undo over a "reset image", the earlier steps will assume a different state than there is. So undo of the attribute reset still has to be implemented.
> In the cases where our image manipulation is destructive, like rotating in
> writer, I'd rather see them made non-destructive(see Bug 73797) and have
> their rotation values reset to default. Impress and Calc should just be able
> to set the rotation angle back to their default value of 0.
This is not really possible. E.g. there is "compress image" -- making that non-destructive totally kills the usecase there. Also "make manipulation non-destuctive" might require to keep additional state (the pre-manipulation image state) and keep it over save-reload circles -- thus possibly requiring file-format extension. It needs careful examination if that is worth it.
(In reply to Björn Michaelsen from comment #7)
> This is not really possible. E.g. there is "compress image" -- making that
> non-destructive totally kills the usecase there. Also "make manipulation
> non-destuctive" might require to keep additional state (the pre-manipulation
> image state) and keep it over save-reload circles -- thus possibly requiring
> file-format extension. It needs careful examination if that is worth it.
So, to further elaborate:
- "reset image" could reset all non-destructive changes to an image
- "reset image" needs to be undoable to keep the UNDO stack consistent (and ultimately: to prevent it from crashing)
- "reset image" doesnt reset destructive changes like "compress image"
- thus destructive changes like "compress image" loose the original state on safe and reload into a new session (you are out of luck then)
- in a running session, one should be able to undo back over them though
Seeing this, this likely also needs explicit documentation for end users.
 This shouldnt be too hard: Just store the pre-change attribute set in an undo object.
I would implement 'reset' as setting all attributes like transformation (rot translate shear scale (includes mirror)), cropping to 'default' -> not set.
The image itself will only be touched with the 'compression' options when used at save time, that will not be resettable and should not be -> having a copy of the original would kill the compression feature and it's intentions.
For the size at reset: Each image has a default size in a way, may it be pixel size and DPI. This is already used at inserting image as new and the only value that needs not only be resetted but new calculated. It is e.g. at original insert time scaled to match maximal sizes defined by PageSizes, so that big images do not/cannot hide everything which would not be what you expect.
For the position: At orig inserting this is different in all apps (canter on page in Draw/Impress, cursor pos in writer, cell in calc) and shuld probably only be changed on reset when the size has to be corrected in the sense mentined above.
All these changes can be packed in an undo action, should be possible.
Dear Bug Submitter,
This bug has been in NEEDINFO status with no change for at least
6 months. Please provide the requested information as soon as
possible and mark the bug as UNCONFIRMED. Due to regular bug
tracker maintenance, if the bug is still in NEEDINFO status with
no change in 30 days the QA team will close the bug as INSUFFICIENTDATA
due to lack of needed information.
For more information about our NEEDINFO policy please read the
wiki located here:
If you have already provided the requested information, please
mark the bug as UNCONFIRMED so that the QA team knows that the
bug is ready to be confirmed.
Thank you for helping us make LibreOffice even better for everyone!
Still to way to reset image attributes in
Build ID: bd7dd48189e5ff7f62e16e53f0a02d1068583108
*** Bug 107262 has been marked as a duplicate of this bug. ***
So what we need is a few image reset UNO commands and ideally it should work in all modules, which unfortunately .uno:OriginalSize doenst (bug 107275).
.uno:ImageResetStyle - This removes styling applied to an image like brightness, contrast, transparency, color mode, rgb tinting, gamma, borders, shadow, area fill, etc.
.uno:ImageResetSize - This removes crop, resets rotation and flip, and sets image size to 100%
.uno:ImageResetStyleAndSize - .uno:ImageResetStyle plus .uno:ImageResetSize
And the help for such new commands should list all actions, which cannot be reset, to avoid false expectations. And help should describe restrictions e.g. by page size.