cfis / free-image-ruby Goto Github PK
View Code? Open in Web Editor NEWFreeImage bindings for Ruby.
License: MIT License
FreeImage bindings for Ruby.
License: MIT License
Hi,
It seems that free-image-ruby needs a FreeImage version > 3.10 since it works fine on my Debian testing development computer (with libfreeimage-dev-3.15.1-1) but fails on the Debian stable pre-production server with version 3.10.0-4.
(The error message reads Function 'FreeImage_HasPixels' not found in [/usr/lib64/libfreeimage.so]
.)
I really think a mention of the minimal FreeImage library version would be most helpful.
In cookbook, there's no example of how to do an image composite -- say for a watermark or something.
I've got code like:
wm = FreeImage::Bitmap.open(@watermark)
img = FreeImage::Bitmap.open(@file)
wm.composite(img)
wm.save(File.join(APP_ROOT, 'done.png'), :png)
but I get
FreeImage::Error: Cannot create a bitmap from a null pointer
Is composite working -- or does only composite_with_color work?
memory = FreeImage::Memory.new
image = FreeImage::Bitmap.open(...)
memory.save(image, :jpeg)
memory.memory.bytes
# => "\xFF\xD8\xFF\xE0"
memory.memory.count
# => 1017134
memory.memory.size
# => 9223372036854775807
This returns a memory object that contains 4 bytes, but has what appears to be the correct bytes count.
If I try image.save(memory, :jpeg)
I get the same result.
white = FreeImage::RGBQuad.create(255, 255, 255)
white.to_s
=> "RGBQuad - Red: 0, Green: 0, Blue: 255, Alpha: 0"
I expected
=> "RGBQuad - Red: 255, Green: 255, Blue: 255, Alpha: 0"
free-image (0.6.2)
Could you please document (perhaps under AbstractSource::Encoder) the fact you can pass any value between 1 and 100 in the flags parameter when saving as JPEG to set a custom quality level. I only found this out from extensive googling on the FreeImage library.
image.save("./thumbnail.jpg", :jpeg, 90)
Cheers
I'm attempting to open an image from an IO stream (File object in this case), but I get the following error:
RangeError: integer 70353457099240 too big to convert to int' from /Users/tomwardrop/.rvm/gems/ruby-2.1.5/gems/free-image-0.6.2/lib/free-image/sources/io.rb:78:in
put_int32'
The cause is that a Ruby fixnum (which Ruby's Object#object_id returns) can be up to 62 bits, where as a C integer has a maximum length of 32 bits. I believe the following line needs to be changed to use a long instead of an int: https://github.com/cfis/free-image-ruby/blob/master/lib/free-image/sources/io.rb#L77
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.