netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.79k stars 2.54k forks source link

Support WebP format image uploads #6588

Closed fknorn closed 3 years ago

fknorn commented 3 years ago

NetBox version

v2.11.4

Feature type

Change to existing functionality

Proposed functionality

Currently, image uploads of a range of "classic" image formates are supported (jpg, png, etc.). However, the WebP-format ist missing in that list. Most modern webbrowser support this format natively and its popularity is evergrowing.

Use case

Upload device type images with transparent background

Database changes

None

External dependencies

Not too sure what kind of internal processing is done to the imagery, but any involved libraries would need to support this format.

jeremystretch commented 3 years ago

NetBox relies on Django's ImageField to model images, which in turn relies on Python's Pillow image processing library. If Pillow and Django support webp images, NetBox should too. However, Pillow's documentation warns:

Pillow reads and writes WebP files. The specifics of Pillow’s capabilities with this format are currently undocumented.

I'll mark this as needs owner for anyone who wants to dig into this.

jeremystretch commented 3 years ago

Seems like all the library support is already there; we just need to add image/webp to the list of accepted image types for DeviceType front and rear images. (Image attachments already support webp files in the current release.)

fknorn commented 3 years ago

Thanks, Jeremy ! Happy summer (at least to all the northern hemispherians :-))