-
-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a loop count setting #218
Conversation
Prior to this change, gifski had two looping modes: off and forever. This change adds a new settings value, called loops, that will loop the animation the number of times requested.
Prior to this change, Gifski had 2 modes of looping, none or forever. This change adds in the ability to loop 1 to 9999 times
|
I already decline this, but seeing as you're willing to put an effort into this, I'm ok with adding it 👍🏻 |
reverts DEVELOPMENT_TEAM changes
|
Prior to this change, the timesShown variable was a little confusing This change updates the timesshown to loopCounter, adds looping support for gifsicle, and makes loopCount an optional field.
Prior to this change, gifsicle would loop forever if a loop counter of 0 was selected. This change will allow a no-looping option.
Prior to this change, UI for looping was not controlled very well This change only allows positive numbers for the loop Counter field, checking the "Forever" box disables the loop counter text field and resets the value to 0, unchecking the forever box enables the loop counter text field. UI is also updated for the looping controls.
Sindre, thank you for your feedback. I am working on the changes. |
Prior to this change, the only way to change the number of loops was to type in a value. This change adds in a stepper control to add a different way to change the number of loops of an animation. The stepper control is disabled and enabled at the same time as the loop counter textfield.
Prior to this change, variable renaming left variables with bad names This change fixes the variables to reflect the correct name
This is not fixed when using arrow keys in the text field to change the value. |
Is it really useful to allow numbers up to 9999? I think we should maybe set the limit at 100. |
There needs to be slight more margin between the text field and the stepper. |
If you choose a loop count, I think the preview player should loop (just like when "Forever" is checked). Ideally, it should loop according to the loop count, but not sure how easy that would be to achieve. |
Good point, anything more than 100 (or 30+) is not much different than looping forever anyway. |
Again, thank you for the feedback. |
Prior to this change, the looping using the once setting was confusing. This change modified the logic flow for looping using the once and loop_count settings. Also applies recommended changes from code review.
The underlying gifski library works as expected for no looping, forever loops or X loops as tested via the command line tool. I need to think more on how the looping is set via the UI as right now it's not working as expected. |
Prior to this change, the upper limit of looping was 9999 and the loop counter text box allowed negative numbers if arrow keys were used to change the value. This change changes the looping range to 0-100 and clamps the values to that range. This change also has UI updates as suggested by code review.
fixes the looping logic on the generated file after tweaks to the gifski library
Prior to this change, the location of the stepper was not aligned to the top of the loop count control. The variable name for the repeatCountRange did not match the rest of the code. This change fixes the UI location of the stepper and renames a variable. Also removes a Rust warning about settings as mutable when it doesn't need to be.
I believe the first baseline of the stepper should be constrained to the first baseline of the text field. I also noticed that the stepper is currently constrained to the slider, which is incorrect. |
Prior to this change, UI constraints to the stepper and forever loop controls were not optimized. This change optimizes the UI constrains for the stepper and loop forever checkbox.
Everything here looks good. Now just waiting for ImageOptim/gifski#151. |
merge in code from gifski cli
upstream changes to gifski's library required changes to how animation looping was coded.
updated code to use the upstream changes to ImageOptim/gifski#151. |
Just noticed that #218 (comment) is not done. |
fixes the state dependency on the Loop Forever checkbox and the Loop Counter textfield
I think I have found a bug in NSImageView. If loading an animated gif into an NSImageView the animation will be shown at total times equal to the loop count (x) setting and not looped x times. e.g. Loop Count is 1, the animation should be shown twice, or repeat the animation 1 time. Also, a Loop Count of 0 in the gif is show the animation once and stop. What I can do to fix the non looping issue is to not animate the image if we are not looping, but I think that would defeat the purpose of the preview window. So how the animation is shown in an NSImaveView is not how any other tool would show the animated gif unless the animated gif's setting is loop forever. |
Can you report this to Apple?
Yeah, I think this applies to Quick Look too. At least I know it ignores the loop count completely. |
Maybe we should have a warning (NSAlert) the first time the user sets the loop count in the UI to just inform them that it usually works, but the preview and Quick Look will not show the correct result? |
Issue reported to Apple Feedback ID FB8947153 I can add a one time alert when the looping/repeat value is not forever. I know there is code out there that splits the animated gif out into individual frames and controls the loop that way, but I think that might be overkill for a screen that is shown for a short period of time and is a smaller view of the resulting animation. |
👍 You can use: Gifski/Gifski/EditVideoViewController.swift Lines 274 to 282 in 5c2d437
Agreed, that's too much. |
Adds an animation preview warning that in the Conversion Completed window, the animation may not reflect the options chosen, but the exported file will be what the user expects. This is a limitation of the NSImageView control.
Gifski/EditVideoViewController.swift
Outdated
NSAlert.showModal( | ||
for: view.window, | ||
message: "Animated GIF Preview Limitation", | ||
informativeText: "The Conversion Completed Preview after processing will not reflect the image repetitions selected. However, the exported file will refelct the options selected and repeat correctly." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be more succinctly written.
And as I commented earlier, Quick Look ignores the loop count and just always loops forever, which should also be mentioned.
"image repetitions" => "loop count"
Also typo.
Gifski/EditVideoViewController.swift
Outdated
@@ -299,6 +299,19 @@ final class EditVideoViewController: NSViewController { | |||
} | |||
} | |||
|
|||
private func showConversionCompletedAnimationWarningIfNeeded() { | |||
// TODO: This function can be removed once NSImageView respects the looping counter in the GIF header. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you mirror the FB you submitted to Apple over at https://github.com/feedback-assistant/reports (follow the template) and then link to it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and thank you! I didn't know this resource existed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is now outdated. The code should not be removed when it's fixed as it also applies to Quick Look. Rather the text should be modified to only mention Quick Look when it's fixed.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
added open feedback assistant link
Prior to this change, This change
Gifski/EditVideoViewController.swift
Outdated
NSAlert.showModal( | ||
for: view.window, | ||
message: "Animated GIF Preview Limitation", | ||
informativeText: "The after conversion preview and Quick Look will may not loop as expect, but the exorted file is valid." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 3 typos in this text. I think it also could be more explicit about in what case it may not loop as expected. Try to spend some more effort on the text.
Prior to this change, This change
This looks good now. Thank you for your hard work :) |
This changes Gifski's gif animation looping modes from none - forever ti add in an in between for looping the animation 1 - 9999 files along with the existing No loops and Forever loops.
I sent in a feature request this morning, and when I looked into what it would take, I challenged myself to add it into the awesome tool.
This code base is based off the latest master for sindresorhus/Gifski and the latest revision to kornelski/rust-ffmpeg