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
Animated images for traces #2204
Conversation
This works around an issue in libgd2 library which would otherwise cause segfaults due to zero sized images
Gemfile
Outdated
@@ -117,7 +117,7 @@ gem "canonical-rails" | |||
gem "logstasher" | |||
|
|||
# Used to generate images for traces | |||
gem "gd2-ffij", :git => 'git@github.com:mmd-osm/gd2-ffij.git', :branch => 'animated_gif' | |||
gem "gd2-ffij", :git => "git@github.com:mmd-osm/gd2-ffij.git", :branch => "animated_gif" |
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.
The git protocol link causes some issues with TravisCI. Maybe try https://github.com/mmd-osm/gd2-ffij.git
instead?
Upstream pull request for gd2-ffij: dark-panda/gd2-ffij#19 |
We're not able to use git deployed gems in our production environment so we can't merge this as is anyway - we would need to publish a forked version to rubygems in order to go this route. |
Is this by policy, or for a technical reason? If it's just a technical reason that needs fixing, then I can do the relevant work on the chef cookbook. |
I honestly can't remember, I just know it didn't work. To be honest given we install globally I'm not even sure what happens if you try and do a git based install, but I'm pretty sure it won't be very nice. |
Awesome, we have some progress in dark-panda/gd2-ffij#18 @tomhughes , @gravitystorm : could you take a look if this makes sense to you? Thanks! |
If this API on my end looks good, I'll wrap this up and do a release quickly for you. Just give me the word and we can wrap this one up. |
@mmd-osm are you happy with it? have you got a version of our code that works with it? |
I was hoping for @gravitystorm to take a look, too. From my side we’re good, one of my code snippets made into the test case collection, and that looks fine. |
I've tested a modified version of this branch with @dark-panda's code and it all seems to work fine so yes @dark-panda please do go ahead and make a new release. |
Sorry - I've been busy for a few weeks (mostly holidays). I think the proposed new interface by @dark-panda looks great, so I look forward to the next release. |
Hope you don't mind. I resolved the merge conflicts. |
0.4.0 is out since a few minutes! https://rubygems.org/gems/gd2-ffij/versions/0.4.0 |
I think we’re only displaying 9 instead of 10 frames after moving to the 0.4.0 API. If you look at the example dark-panda/gd2-ffij#18 (comment) it’s clear that we need to add frame 1 twice, which we fail to do atm. It’s probably better to add the first frame right before entering the loop, otherwise the animation doesn't start with the beginning of the GPX track, which is confusing. image = GD2::AnimatedGif.new
image.add(frames[0]) " << new line to be added
frames.each do |frame|
image.add(frame, :delay => delay)
end
image.end |
@tomhughes : I feels a bit like overkill to create a new pull request for this one liner. Could you please take over this issue? |
I think we have one more issue with the points_per_frame calculation, which is visible in the following trace: https://www.openstreetmap.org/user/Waclaw1/traces/3014390 The issue here is probably that the current points_per_frame logic only applies integer division, so that some points towards the end of a trace might be omitted. Could we change this to something like:
Result looks better then: |
It's always worthwhile creating a pull request - firstly it gives you credit, and secondly it removes any ambiguity over exactly which line you mean. There's also another practical reason:
Tom's a busy guy, so it's worth sharing the development load around rather than asking him to take on more tasks himself. I'm happy to review and merge pull requests, as is Tom. I prefer to have a review of the work I've created myself. So in general there are three options available:
Only the final option can avoid more work for Tom! So it's best to create PRs whenever possible. |
I try and do PRs for my stuff where it's non-urgent as well especially if it's larger or controversial in any sort of way... Which reminds me - any thoughts people have on #2209 would be appreciated ;-) |
Here's a pull request based on @mmd-osm's work with a few minor changes from me. It produces animated gifs that look identical to those generated by the external importer.
This PR contains two notable caveats: