Git Product home page Git Product logo

heif-image-plugin's Introduction

Uploadcare Ruby Gem

Simple ruby gem to interact with the Uploadcare API

Example Usage

require 'uploadcare'
pubkey = "d1531fba1b7fd176feaec8d1e7d86650ac549b9644e9279197a8c901243509dc"
pvtkey = "2f769cf086ece700f69fc58fb61e64a7708fee777068dc3f75798ae6166891f1"
file_id = "b6nn9f2d-1aj2-6q87-ofk0-265d8nki0diu"
ucare = Uploadcare.new(pubkey, pvtkey)
file = ucare.file(file_id)
file.info # Returns the files info hash
file.keep # Returns the updated info hash

Example Info Hashes

Preclaim Hash:

{
	"upload_date"=>"2011-10-25 02:05:50",
	"last_keep_claim"=>nil,
	"on_s3"=>true,
	"url"=>"http://api.uploadcare.com/api/files/b6nn9f2d-1aj2-6q87-ofk0-265d8nki0diu/",
	"file_id"=>"b6nn9f2d-1aj2-6q87-ofk0-265d8nki0diu",
	"original_filename"=>"test-image.png",
	"original_file_url"=>nil
}

Postclaim Hash:

{
	"upload_date"=>"2011-10-25 02:05:50",
	"last_keep_claim"=>"2011-10-25 02:19:06",
	"on_s3"=>true,
	"url"=>"http://api.uploadcare.com/api/files/b6nn9f2d-1aj2-6q87-ofk0-265d8nki0diu/",
	"file_id"=>"b6nn9f2d-1aj2-6q87-ofk0-265d8nki0diu",
	"original_filename"=>"test-image.png",
	"original_file_url"=>"http://s3.amazonaws.com/uploadcare/b6nn9f2d-1aj2-6q87-ofk0-265d8nki0diu/testimage.png"
}

Notes

All data in the examples (pubkey, pvtkey, file_id, example hashses) are intended to show usage and format. These values are randomly generated strings for this example and are therefore not valid. You must use your own public and private key, as well as a valid file id. Since the API is still very limited, thats about the extent of what you can do. Once delete functionallity is added to the API I will update the gem

heif-image-plugin's People

Contributors

ciotto avatar homm avatar hpoul avatar mikhail-iurkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

heif-image-plugin's Issues

Register heic/heif extensions

I have been migrating away from https://github.com/ciotto/pyheif-pillow-opener and got an error that .heic extension was not supported. After looking into it, it seems pillow-opener registered the extensions. I think it would be good to add it to this plugin as well:

https://github.com/ciotto/pyheif-pillow-opener/blob/5cf38718bcfb07edb9ac56e0a6dc13ff7b4e9830/pyheif_pillow_opener/__init__.py#L84-L88

Image.register_extensions(HeifImageFile.format, ['.heic', '.heif'])

Does not work with Pillow 10.1, ImageFile.mode can no longer be set directly

Describe the bug

Does not work with Pillow 10.1. The attribute ImageFile.mode can no longer be set directly.

This is the same issue as: imageio/imageio#1044

I can get it work by monkeypatching the HeifImageFile._open function, changing the line:

self.mode = heif_file.mode

to

self._mode = heif_file.mode

but would be good to have a proper fix.

Steps to reproduce

import HeifImagePlugin
from PIL import Image, ImageOps

with Image.open('some-heic-file.heic') as image:
    # raises exception here

Code / screenshots

  File "/opt/venvs/python/lib/python3.11/site-packages/PIL/Image.py", line 3284, in open
    im = _open_core(fp, filename, prefix, formats)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/python/lib/python3.11/site-packages/PIL/Image.py", line 3270, in _open_core
    im = factory(fp, filename)
         ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venvs/python/lib/python3.11/site-packages/PIL/ImageFile.py", line 117, in __init__
    self._open()
  File "/opt/venvs/python/lib/python3.11/site-packages/HeifImagePlugin.py", line 117, in _open
    self.mode = heif_file.mode
    ^^^^^^^^^
AttributeError: property 'mode' of 'HeifImageFile' object has no setter

Environment

  • Library version: heif-image-plugin==0.6.0
  • Language/framework version: Python 3.11.5
  • OS version: CentOS 7.9

using the plugin with Pillow (used by sigal, static image gallery generator ) it crashes:

Describe the bug

using the plugin with Pillow (used by sigal, static image gallery generator ) it crashes:

Collecting albums, done.
Sorting albums [####################################] 100%
Sorting media [####################################] 100%
Collecting files [####################################] 100%
Processing files [------------------------------------] 0/2
Traceback (most recent call last):
File "/home/simon/python_virt_sigal/env/bin/sigal", line 8, in
sys.exit(main())
File "/home/simon/python_virt_sigal/env/lib/python3.9/site-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/home/simon/python_virt_sigal/env/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/simon/python_virt_sigal/env/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/simon/python_virt_sigal/env/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/simon/python_virt_sigal/env/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/simon/python_virt_sigal/env/lib/python3.9/site-packages/sigal/init.py", line 157, in build
gal.build(force=force)
File "/home/simon/python_virt_sigal/env/lib/python3.9/site-packages/sigal/gallery.py", line 756, in build
for status in self.pool.imap_unordered(worker, media_list):
File "/usr/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
File "/usr/lib/python3.9/multiprocessing/pool.py", line 537, in _handle_tasks
put(task)
File "/usr/lib/python3.9/multiprocessing/connection.py", line 211, in send
self._send_bytes(_ForkingPickler.dumps(obj))
File "/usr/lib/python3.9/multiprocessing/reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
TypeError: cannot pickle 'module' object

i do generate image gallery with sigal, which uses Pillow

i do generate image gallery with sigal, which uses Pillow

Expected behavior

Pillow can handle heif images with this plugin and the gallery generates

Code / screenshots

grafik
grafik

Environment

  • Library version:
  • Language/framework version:
  • OS version:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.