Git Product home page Git Product logo

jpeg's People

Contributors

s-u avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jpeg's Issues

readJPEG does not seem to format messages properly

Hi Simon,

I've been struggling with images that are "partially corrupted" - that is, part of the image is cut off by a large black or grey area (see example image, here). If I run "readJPEG" on this image like this:

img <- readJPEG("2017-08-30 00-17-42 M 1_5.JPG")

the output is:

JPEG decompression: Corrupt JPEG data: premature end of data segment.

As far as I can tell, this "message" is not actually a message or a warning, which makes it really difficult to do error checking or to capture that message or warning (for example, in tryCatch). For a more fulsome explanation of why this is troublesome, consider my question at stack overflow (here), if you're interested.

In any case, is it possible to change the function (or provide a similar one, like readJPEG2) that outputs that explanatory text as a message or warning?

Install error on macOS Catalina: 'jpeglib.h' file not found

Checked on

  • R 3.6.3 and R 4.0 beta
  • SDK 10.15 and SDK 10.13

The jpeg lib is installed and linked via homebrew.

install.packages("jpeg", type = "source")
#> Installing package into '/Users/pjs/Library/R/4.0/library'
#> (as 'lib' is unspecified)
* installing *source* packagejpeg...
** packagejpegsuccessfully unpacked and MD5 sums checked
** using staged installation
** libs
ccache clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c read.c -o read.o
In file included from read.c:1:
./rjcommon.h:11:10: fatal error: 'jpeglib.h' file not found
#include <jpeglib.h>
         ^~~~~~~~~~~
1 error generated.
make: *** [read.o] Error 1
ERROR: compilation failed for packagejpeg* removing/Users/pjs/Library/R/4.0/library/jpeg* restoring previous/Users/pjs/Library/R/4.0/library/jpegThe downloaded source packages are in/private/var/folders/w5/1wdhg7nd4zj7td7_pkgrl4fm0000gn/T/RtmpQjlll2/downloaded_packagesWarning message:
In install.packages("jpeg", type = "source") :

Created on 2020-04-13 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                                   
#>  version  R version 4.0.0 beta (2020-04-12 r78209)
#>  os       macOS Catalina 10.15.4                  
#>  system   x86_64, darwin17.0                      
#>  ui       X11                                     
#>  language (EN)                                    
#>  collate  en_US.UTF-8                             
#>  ctype    en_US.UTF-8                             
#>  tz       Europe/Berlin                           
#>  date     2020-04-13                              
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.0)
#>  backports     1.1.6   2020-04-05 [1] CRAN (R 4.0.0)
#>  callr         3.4.3   2020-03-28 [1] CRAN (R 4.0.0)
#>  cli           2.0.2   2020-02-28 [1] CRAN (R 4.0.0)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.0)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.0)
#>  devtools      2.3.0   2020-04-10 [1] CRAN (R 4.0.0)
#>  digest        0.6.25  2020-02-23 [1] CRAN (R 4.0.0)
#>  ellipsis      0.3.0   2019-09-20 [1] CRAN (R 4.0.0)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.0)
#>  fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.0)
#>  fs            1.4.1   2020-04-04 [1] CRAN (R 4.0.0)
#>  glue          1.4.0   2020-04-03 [1] CRAN (R 4.0.0)
#>  highr         0.8     2019-03-20 [1] CRAN (R 4.0.0)
#>  htmltools     0.4.0   2019-10-04 [1] CRAN (R 4.0.0)
#>  knitr         1.28    2020-02-06 [1] CRAN (R 4.0.0)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.0)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.0)
#>  pkgbuild      1.0.6   2019-10-09 [1] CRAN (R 4.0.0)
#>  pkgload       1.0.2   2018-10-29 [1] CRAN (R 4.0.0)
#>  prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.0)
#>  processx      3.4.2   2020-02-09 [1] CRAN (R 4.0.0)
#>  ps            1.3.2   2020-02-13 [1] CRAN (R 4.0.0)
#>  R6            2.4.1   2019-11-12 [1] CRAN (R 4.0.0)
#>  Rcpp          1.0.4.6 2020-04-09 [1] CRAN (R 4.0.0)
#>  remotes       2.1.1   2020-02-15 [1] CRAN (R 4.0.0)
#>  rlang         0.4.5   2020-03-01 [1] CRAN (R 4.0.0)
#>  rmarkdown     2.1     2020-01-20 [1] CRAN (R 4.0.0)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.0)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.0)
#>  stringi       1.4.6   2020-02-17 [1] CRAN (R 4.0.0)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.0)
#>  testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.0)
#>  usethis       1.6.0   2020-04-09 [1] CRAN (R 4.0.0)
#>  withr         2.1.2   2018-03-15 [1] CRAN (R 4.0.0)
#>  xfun          0.13    2020-04-13 [1] CRAN (R 4.0.0)
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.0)
#> 
#> [1] /Users/pjs/Library/R/4.0/library
#> [2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

Error on installation

Hi!
I tried to install package as a part of "ggmap" installation:
devtools::install_github("s-u/jpeg")

And get the following errors

  • installing source package ‘jpeg’ ...
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c read.c -o read.o
    In file included from read.c:1:0:
    rjcommon.h:11:21: fatal error: jpeglib.h: No such file or directory
    compilation terminated.
    /usr/lib/R/etc/Makeconf:159: recipe for target 'read.o' failed
    make: *** [read.o] Error 1
    ERROR: compilation failed for package ‘jpeg’
  • removing ‘/home/andrii/R/x86_64-pc-lin

Will be glad to know how to fix it

Installation Error

Hi,

I'm just trying to download the package in RStudio and having mega issues. I even uninstalled R and RStudio and brought them back but to no avail. Here's what I'm getting in the console when I try to install. If there's anything I'm doing wrong, please let me know. Thanks

(as ‘lib’ is unspecified)
trying URL 'http://rforge.net/src/contrib/jpeg_0.1-9.tar.gz'
Content type 'application/x-gzip' length 18097 bytes (17 KB)
downloaded 17 KB

* installing *source* package 'jpeg' ...
** using staged installation
  checking JPEG headers and libraries
  LOCAL_SOFT does not exist, fall back to external jpeg
  cannot find current JPEG files
  attempting to download them
Error in download.file("http://www.rforge.net/jpeg/files/libjpeg-current-win.tar.gz",  : 
  cannot open destfile 'src/libjpeg-current-win.tar.gz', reason 'No such file or directory'
Execution halted

 *** ERROR: unable to find JPEG files

 They must be either in src/win32, in a tar-ball
 src/libjpeg-current-win.tar.gz or
 available via the LOCAL_SOFT R make setting.

 You can get the latest binary tar ball from
 http://www.rforge.net/jpeg/files/

ERROR: configuration failed for package 'jpeg'
* removing 'C:/Users/MadisonDC/Documents/R/win-library/4.1/jpeg'
Warning in install.packages :
  installation of package ‘jpeg’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\MadisonDC\AppData\Local\Temp\RtmpctQ5UI\downloaded_packages’

Installing with non-standard location of libjpeg

I don't think this has been documented, so just wanted to share installation instructions if libjpeg is installed in a non-standard location, on Linux at least. Enter something like the following in the shell:

export JPEG_CFLAGS=-I/path/to/libjpeg/include
export JPEG_LIBS=-L/path/to/libjpeg/lib

Make sure to substitute the libjpeg installation path.

Then within R, install the jpeg package like normal.

Installation error: ld: library not found for -ljpeg

Hi, I am trying to install by compiling from source on R 4.0.3 on BigSur 11.2 and get this error:

ld: library not found for -ljpeg
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [qpdf.so] Error 1
ERROR: compilation failed for package `‘qpdf’```

I have libjpeg 9d installed via Homebrew. I tried to reinstall and re-start R with no success. No matter what, the error persists. Any suggestions? Thanks

High format images are read as landscape images

I have two cat images, one in high format and one in landscape format (https://www.dropbox.com/sh/7xa9jfxlsr6wy5s/AABVZJO0GrwvuVb9qryJjCG7a?dl=0). When I read them with readJPEG the dimensions for both are the same:

jpg1 <- readJPEG("/Volumes/Vero/Data/Animals/Cat/20150805_172829743_iOS.jpg")
jpg2 <- readJPEG("/Volumes/Vero/Data/Animals/Cat/20150808_183100413_iOS.jpg")
str(jpg1)
str(jpg2)

The last two lines both print num [1:2448, 1:3264, 1:3] 0.996 0.996 0.996 0.996 0.996 ... although the first (high format) should be [1:3264 1:2448 1:3]. When I save them again with writeJPEG the landscape one looks normal (although its larger than before) and the other one is mixed up (it's rather large so I don't upload it except you would like me to).

After using jpg1_a <- aperm(jpg1, c(2, 1, 3)) and writing the image it looks normal but rotated.

Is there something wrong with the library or is it a problem with my image? (I have encountered that some other programs also have problems with photos taken by an iPhone).

Best regards,
Verena

EDIT: I looked a little further and found out that the rotation would be in the exif data (1 for "normal" and 6 for "rotated"), e.g. explained here. [http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/](EXIF orientation handling is a ghetto). I'm trying to figure out a way based on the [https://github.com/ironholds/exif](exif meta data) to handle my images correctly. I don't know if you will/want to include this information in your package.

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.