tomasc / dragonfly_libvips Goto Github PK
View Code? Open in Web Editor NEWDragonfly analysers and processors for libvips image processing library.
License: MIT License
Dragonfly analysers and processors for libvips image processing library.
License: MIT License
Is there any way to use geometry 400x300#
as in imagemagick?
It resizes and crops if necessary to maintain aspect ratio (centre gravity) http://markevans.github.io/dragonfly/imagemagick#processors
Running the test suite I get this error (x6)
test_0080_pdf to raw ERROR (0.00s)
Minitest::UnexpectedError: Vips::Error: VipsRegion: valid clipped to nothing
VipsForeignSave: ".raw" is not a known buffer format
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ruby-vips-2.1.2/lib/vips/image.rb:627:in `write_to_buffer'
/private/var/www/dragonfly_libvips/lib/dragonfly_libvips/processors/encode.rb:44:in `call'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job/process.rb:23:in `apply'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:119:in `block in apply'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:119:in `each'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:119:in `apply'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:250:in `result'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/2.7.0/forwardable.rb:229:in `mime_type'
/private/var/www/dragonfly_libvips/test/dragonfly_libvips/processors/encode_test.rb:20:in `block (5 levels) in <top (required)>'
I can't see what/why it is happening.
In some instances the error "valid clipped to nothing" is repeated many times - perhaps that is the real problem.
Hi @tomasc,
Looking into performance/speed/compression it seems that progressive JPEGs are preferred (here, here or here).
Currently the thumbnail processor does not generate progressive JPEGs and I'm wondering if this might not be a useful addition? Could also be a new processor, but since it's only for JPEGs I'm not sure how to implement that.
It unfortunately seems that vips' .thumbnail
method does not support "interlacing" (progressive), but it can be done with the .jpegsave
method: https://github.com/jcupitt/ruby-vips/blob/428d5c106fb4a64521159c6b0c4f9391eea2eba6/lib/vips/methods.rb#L1333
Let me know your thoughts and I can try and take a stab at this ๐
Hello
While using
(notice: those versions are the newest releases of libraries) there is an argument error wrong number of arguments (given 2, expected 1)
while calling stack trace:
ruby-vips (2.1.4) lib/vips/image.rb:273:in `new_from_file'
dragonfly_libvips (2.4.2) lib/dragonfly_libvips/analysers/image_properties.rb:17:in `call'
links to source code to your convenience:
https://github.com/libvips/ruby-vips/blob/master/lib/vips/image.rb#L273
and dragonfly https://github.com/tomasc/dragonfly_libvips/blob/master/lib/dragonfly_libvips/analysers/image_properties.rb#L17
We can extract this logic to a simple example to run in any Ruby 3.1.0 REPL:
def new_from_file name, **opts
puts("name: #{name}, opts: #{opts}")
puts("it worked!")
end
opts = { a: 'a', b: 'b' }
#good
new_from_file "good", **opts
# bad
new_from_file "bad", opts
which executes to:
name: good, opts: {:a=>"a", :b=>"b"}
it worked!
ArgumentError: wrong number of arguments (given 2, expected 1)
from (pry):1:in `new_from_file'
I am running the test suite (in preparation for submitting a PR) and getting this failure, which is not, I think, related to the PR. Here is the stack trace:
test_0118_svg to jpc ERROR (0.00s)
Minitest::UnexpectedError: Vips::Error: unable to call VipsForeignSaveJp2kBuffer: unknown option profile
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ruby-vips-2.1.2/lib/vips/operation.rb:379:in `block in call'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ruby-vips-2.1.2/lib/vips/operation.rb:374:in `each'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ruby-vips-2.1.2/lib/vips/operation.rb:374:in `call'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/ruby-vips-2.1.2/lib/vips/image.rb:629:in `write_to_buffer'
/private/var/www/dragonfly_libvips/lib/dragonfly_libvips/processors/encode.rb:44:in `call'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job/process.rb:23:in `apply'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:119:in `block in apply'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:119:in `each'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:119:in `apply'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/job.rb:250:in `result'
/Users/anita/.rbenv/versions/2.7.2/lib/ruby/2.7.0/forwardable.rb:229:in `mime_type'
/private/var/www/dragonfly_libvips/test/dragonfly_libvips/processors/encode_test.rb:20:in `block (5 levels) in <top (required)>'
I am running
The doc for jp2ksave
doesn't include :profile
in the options list.
(Checked pngsave
- does include :profile
)
If it is as simple as adding jp2k
to list of options without profile support I can submit a PR for that.
Is there anywhere else to look?
thanks,
Anita
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.