Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
A pure Ruby library with no external dependencies that allows to encode, decode and edit GIFs. Its main goals are to:
Currently, the specs are almost fully supported for encoding. Decoding is not yet available, but will be soon. There's a solid Geometry
module and decent drawing functionality. See the Reference for the full documentation, as well as Examples for a list of sample snippets and GIFs.
Consider the following GIF and the variation next to it. They already showcase most of the main elements of the format, including global and local color tables, transparency, animation, and different disposal methods. It also makes use of some basic drawing methods:
The code to generate the first version with Gifenc
is the following:
require 'gifenc'
# Build a couple color tables
reds = Gifenc::ColorTable.new(64.times.map{ |c| 4 * c << 16 | 0x40 } + [0])
greens = Gifenc::ColorTable.new(4.times.map{ |c| 64 * c << 8 | 0x40 })
# Paint a first frame that will act as a background, using a local color table
gif = Gifenc::Gif.new(128, 128, gct: reds, loops: -1)
gif.images << Gifenc::Image.new(128, 128, lct: greens, color: 0, delay: 2, trans_color: 0)
(1 ... 4).each do |z|
gif.images.last.rect(16 * z, 16 * z, 128 - 32 * z, 128 - 32 * z, z, z)
end
# Add animation frames drawing a gradient, using the global color table
(0 ... 8).each do |y|
(0 ... 8).each do |x|
gif.images << Gifenc::Image.new(
14, 14, 16 * x + 1, 16 * y + 1, color: 8 * y + x, delay: 5, trans_color: 64
).rect(4, 4, 6, 6, 64, 64)
end
end
# Export the GIF to a file
gif.save('test.gif')
Let's see a step-by-step overview, refer to the documentation for an in-depth explanation of the actual details for each of the topics involved.
Gifenc
comes equipped with several default ones, but you can build your own, and operate with them.Producing the second variation is surprisingly simple. It suffices to add the option disposal: Gifenc::DISPOSAL_PREV
to the frames (except for the background). More on this later.
See the Examples folder for more code samples; the resulting GIFs are stored here.
The following are a few of the excellent resources one can find on the net to get a deep understanding of the GIF file format.
FAQs
Unknown package
We found that gifenc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.