Python library that finds the size / type of an image given its URI by fetching as little as needed

Overview

FastImage travis

This is an implementation of the excellent Ruby library FastImage - but for Python.

FastImage finds the size or type of an image given its uri by fetching as little as needed.

Installation

pip install fastimage

Usage

Usage is pretty dang simple.

import asyncio
from fastimage.detect import get_size

loop = asyncio.get_event_loop()
url = "http://stephensykes.com/images/ss.com_x.gif"
width, height = loop.run_until_complete(get_size(url))
print("Size:", width, "x", height)

which will poop out:

Size: 266 x 56

You can also just get the image type:

import asyncio
from fastimage.detect import get_type

loop = asyncio.get_event_loop()
url = "http://stephensykes.com/images/ss.com_x.gif"
result = loop.run_until_complete(get_type(url))
print("Type:", result)

which will poop out:

Type: gif

Right now, sizes can be deduced from webp / gif / jpg / png. Additionally, it can detect the type (but not size) of bmp / tiff.

You might also like...
Image Reading, Metadata Conversion, and Image Writing for Microscopy Images in Python

AICSImageIO Image Reading, Metadata Conversion, and Image Writing for Microscopy Images in Pure Python Features Supports reading metadata and imaging

A Python Script to convert Normal PNG Image to Apple iDOT PNG Image.

idot-png-encoder A Python Script to convert Normal PNG Image to Apple iDOT PNG Image (Multi-threaded Decoding PNG). Usage idotpngencoder.py -i inputf

Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.
Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Pyconvert is a python script that you can use to convert image files to another image format! (eg. PNG to ICO)
Pyconvert is a python script that you can use to convert image files to another image format! (eg. PNG to ICO)

Pyconvert is a python script that you can use to convert image files to another image format! (eg. PNG to ICO)

Simple Python package to convert an image into a quantized image using a customizable palette
Simple Python package to convert an image into a quantized image using a customizable palette

Simple Python package to convert an image into a quantized image using a customizable palette. Resulting image can be displayed by ePaper displays such as Waveshare displays.

starfish is a Python library for processing images of image-based spatial transcriptomics.
starfish is a Python library for processing images of image-based spatial transcriptomics.

starfish: scalable pipelines for image-based transcriptomics starfish is a Python library for processing images of image-based spatial transcriptomics

An open source image editor which can manipulate an image in many ways!

Image Editor - An open source image editor which can manipulate an image in many ways! If you need any more modes in repo or I

Image enhancing model for making a blurred image to be somehow clearer than before

This is a very small prject which helps in enhancing the images by taking a Input images. This project has many features like detcting the faces and enhaning the faces itself and also a feature which enhances the whole image

Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.
Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.

img2dataset Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine. Also supports

Comments
  • Support of AVIF

    Support of AVIF

    hello, since AVIF format becomes more and more popular, would be great if support of HEIC/AVIF formats would be added.

    Here is the implementation of HEIC support in ruby fastimage : https://github.com/sdsykes/fastimage/pull/125/files Here is implementation of AVIF support(which generally uses the same code as HEIC, since both of them have ISO_BMFF format.): https://github.com/sdsykes/fastimage/pull/135/files

    Thank you!

    enhancement help wanted 
    opened by entGriff 1
Owner
Brian Muller
Ich bin in meiner daten verheddert. "brave (and arguably savvy)" - Forbes
Brian Muller
A little Python tool to convert a TrueType (ttf/otf) font into a PNG for use in demos.

font2png A little Python tool to convert a TrueType (ttf/otf) font into a PNG for use in demos. To use from command line it expects python3 to be at /

Rich Elmes 3 Dec 22, 2021
HyperBlend is a new type of hyperspectral image simulator based on Blender.

HyperBlend version 0.1.0 This is the HyperBlend leaf spectra simulator developed in Spectral Laboratory of University of Jyväskylä. You can use and mo

SILMAE 2 Jun 20, 2022
missing-pixel-filler is a python package that, given images that may contain missing data regions (like satellite imagery with swath gaps), returns these images with the regions filled.

Missing Pixel Filler This is the official code repository for the Missing Pixel Filler by SpaceML. missing-pixel-filler is a python package that, give

SpaceML 11 Jul 19, 2022
This Github Action automatically creates a GIF from a given web page to display on your project README

This Github Action automatically creates a GIF from a given web page to display on your project README

Pablo Lecolinet 28 Dec 15, 2022
Draw a torus passing through three given points.

PyTorusThreePoints Draw a torus passing through three given points. Usage import numpy as np import pyvista as pv from torus_three_points.main import

null 2 Nov 19, 2021
Xmas-Tree-GIF-Tool - Convert any given animated gif file into an animation in GIFT CSV format

This repo is made to participate in Matt Parker's XmasTree 2021 event. Convert a

Aven Zitzelberger 2 Dec 30, 2021
Seaborn-image is a Python image visualization library based on matplotlib and provides a high-level API to draw attractive and informative images quickly and effectively.

seaborn-image: image data visualization Description Seaborn-image is a Python image visualization library based on matplotlib and provides a high-leve

null 48 Jan 5, 2023
Nanosensor Image Processor (NanoImgPro), a python-based image analysis tool for dopamine nanosensors

NanoImgPro Nanosensor Image Processor (NanoImgPro), a python-based image analysis tool for dopamine nanosensors NanoImgPro.py contains the main class

null 1 Mar 2, 2022
A pure python implementation of the GIMP XCF image format. Use this to interact with GIMP image formats

Pure Python implementation of the GIMP image formats (.xcf projects as well as brushes, patterns, etc)

FHPyhtonUtils 8 Dec 30, 2022
Image-Viewer is a Windows image viewer based on Python 3.

Image-Viewer Hi! Image-Viewer is a Windows image viewer based on Python 3. Using You must download Image-Viewer.exe from the root of the repository. T

null 2 Apr 18, 2022