Skip to content

Commit 4025fc5

Browse files
vfdev-5NicolasHug
andauthored
Fixed setup.py when missing libjpeg (#7840)
Co-authored-by: Nicolas Hug <nh.nicolas.hug@gmail.com>
1 parent 69220e0 commit 4025fc5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ Torchvision currently supports the following image backends:
8282
- [libjpeg](http://ijg.org/) - can be installed via conda `conda install jpeg` or any of the package managers for
8383
debian-based and RHEL-based Linux distributions. [libjpeg-turbo](https://libjpeg-turbo.org/) can be used as well.
8484

85-
**Notes:** `libpng` and `libjpeg` must be available at compilation time in order to be available. Make sure that it is
86-
available on the standard library locations, otherwise, add the include and library paths in the environment variables
87-
`TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY`, respectively.
85+
**Notes:** `libpng` and `libjpeg` are optional dependencies. If any of them is available on the system,
86+
torchvision will provide encoding/decoding image functionalities from `torchvision.io.image`.
87+
When building torchvision from source, `libpng` and `libjpeg` can be found on the standard library locations.
88+
Otherwise, please use `TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY` environment variables to set up include and library paths.
8889

8990
## Video Backend
9091

torchvision/csrc/io/image/cpu/decode_jpeg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ torch::Tensor decode_jpeg(const torch::Tensor& data, ImageReadMode mode) {
155155
#endif // #if !JPEG_FOUND
156156

157157
int64_t _jpeg_version() {
158-
#ifdef JPEG_FOUND
158+
#if JPEG_FOUND
159159
return JPEG_LIB_VERSION;
160160
#else
161161
return -1;

0 commit comments

Comments
 (0)