Skip to content

The pngsave method is not recognizing the bitdepth option #317

@demitrious-tom

Description

@demitrious-tom

OS: WSL: Unbuntu 20.04

Hello,
I am attempting to use ruby-vips 2.1 in a rails 6.1.3 application using ruby 3.0.0 to take file that has been decoded from a base64 encoded string and use #pngsave to save that file as an 8-bit png, by passing in the bitdepth option with the value 8. I discovered this documentation https://www.rubydoc.info/gems/ruby-vips/Vips/Image#pngsave-instance_method which says that 8 is a valid option though after reading this comment #230 (comment) I was not sure if only 1, 2 and 4 bit were supported. In any case regardless of the integer value I pass, the error that I get when attempting to do this does not make much sense; "Vips::Error (unable to call pngsave: unknown option bitdepth)". This is the code:

File.open('design.png', 'wb') do |f|
  f.write(Base64.decode64(base_64_encoded_data))
end
im = Vips::Image.new_from_file('design.png')
im.pngsave('new_design.png', bitdepth: 4)

If I call the pngsave method with any other option it behaves as expected. I am a little embarrassed to admit I not sure how to check which version of libvips I installed a week ago with sudo apt-get install libvips on WSL Unbuntu after typing libvips -v, --version I was out of ideas :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy