Skip to content
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

Pass framesInfo to the CallBack #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Pass framesInfo to the CallBack #42

wants to merge 3 commits into from

Conversation

Snelius30
Copy link

Get frames Info from the GifReader object and pass to the CB as additional param.

@benwiley4000
Copy link
Collaborator

@Snelius30 this looks good! Could you:

  • Document in the README that framesInfo gets returned as an additional argument in the GIF case
  • Remove semicolons for style consistency

Thank you!

@Snelius30
Copy link
Author

OK, will do that.

@Snelius30
Copy link
Author

Please check.

@benwiley4000
Copy link
Collaborator

@Snelius30 this looks great! Sorry, one more request. I think the ordering of the docs is a bit funny now... it might be better if it looked like this:

...

**Returns** An ndarray of pixels in raster order having shape equal to `[width, height, channels]` and `frameInfo` param if available (for animated GIFs).

**Note** For animated GIFs, a 4D array is returned with shape `[numFrames, width, height, 4]`, where each frame is a slice of the final array.

**Note** `frameInfo` is an Array of Objects with these fields:
 Name|Type|Description
----|-----|-----------
x | Integer | Image Left Position
y | Integer | Image Top Position
width | Integer | Image Width
height | Integer | Image Height
has_local_palette | Boolean | Image local palette presentation flag
palette_offset | Integer | Image palette offset
palette_size | Integer | Image palette size
data_offset | Integer | Image data offset
data_length | Integer | Image data length
transparent_index | Integer | Transparent Color Index
interlaced | Boolean | Interlace Flag
delay | Integer | Delay Time (1/100ths of a second)
disposal | Integer | Disposal method
 See GIF spec for details. Summary http://www.onicos.com/staff/iz/formats/gif.html

I think the note about the 4d array is more important than the frameInfo description, so this way it doesn't get pushed to the bottom.

I also think it might be better to contribute the frameInfo table to the omggif documentation, but since omggif has no documentation at the moment, I think it's ok to commit it to this README. I'd suggest opening a pull request over there with some markdown documentation though, and updating this README to link to that doc once it's accepted.

@benwiley4000
Copy link
Collaborator

I opened an issue in omggif because I want to make sure it's safe to consume this API.

@Snelius30
Copy link
Author

OK, we have corrected ordering now. I just thought that we need to explain frameInfo as mention but u right this one correction is better.

@benwiley4000
Copy link
Collaborator

Aawesome, thanks! Looks great. ✔️

I want to wait a couple of days to see if there's a response in the omggif issue thread to make sure we're doing the right thing.. Otherwise I think this is pretty good to go. I also want to make sure we're doing the right thing adding an extra argument.. are there other arguments we might also want to add in the future?

@Snelius30
Copy link
Author

Sure, you can extend CB params as u wish in future.

@benwiley4000
Copy link
Collaborator

Right, but my main concern is that we don't start adding a long series of extra params in arbitrary order. It could potentially be a better idea to use a hash param if we think the list will grow.

@Snelius30
Copy link
Author

Snelius30 commented Oct 13, 2018

Well, we can use a some rule. For example If argc >= 3 then we should use a hash based args. Right now i think it's ok and it can be made in future with bump major version.

Copy link
Collaborator

@benwiley4000 benwiley4000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll go ahead and approve this. I'll wait on @mikolalysenko to merge and release since I don't think I have release privileges anyway. In the meantime we can publish a fork to use for gif-frames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants