patternize icon indicating copy to clipboard operation
patternize copied to clipboard

Image calibration - unsupported output file format

Open janisuser opened this issue 4 years ago • 14 comments

Hi Steven!

I am trying to calibrate my pictures and everything seems to work well until it comes about saving the image. Then I always run into the same error "Error in imager::save.image(imCal, paste(IDlist[n], "_calibrated", extension, : Unsupported output file format. Use jpg/png or install ImageMagick" (imager and magick packages are loaded, though).

Originally, I used 'none' as extension, however as the error message came up, I tried to vary parameters and tried changing extension to ".jpg" or ".png". Then, another error message appears right before any calibration process starts: "Error in wrap.url(file, load.image.internal) : File not found".

Please excuse if the solution to this is trivial, I am new to image analysis. Thanks for your suggestions!

Janis

janisuser avatar Jul 24 '21 21:07 janisuser

Hi Janis,

Sorry for your error.

Regarding your first error, imagemagick determines the output format from the file extension, so you have to set it.

Regarding your second error, can you check that your working directory is set correctly (it will search for your image from there)? Maybe also fill in a prepath (subfolder) and see if that changes anything. The last error you are getting sounds like it’s not finding the input image.

Hope this helps!

Steven

From: @.> Sent: Saturday, July 24, 2021 5:35 PM To: @.> Cc: @.***> Subject: [StevenVB12/patternize] Image calibration - unsupported output file format (#26)

Hi Steven!

I am trying to calibrate my pictures and everything seems to work well until it comes about saving the image. Then I always run into the same error "Error in imager::save.image(imCal, paste(IDlist[n], "_calibrated", extension, : Unsupported output file format. Use jpg/png or install ImageMagick" (imager and magick packages are loaded, though).

Originally, I used 'none' as extension, however as the error message came up, I tried to vary parameters and tried changing extension to ".jpg" or ".png". Then, another error message appears right before any calibration process starts: "Error in wrap.url(file, load.image.internal) : File not found".

Please excuse if the solution to this is trivial, I am new to image analysis. Thanks for your suggestions!

Janis

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/26, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC43J2WDGRF4VO65YXLTTZMW33ANCNFSM5A53DX6Q.

StevenVB12 avatar Jul 25 '21 16:07 StevenVB12

Hi Steven,

The working directory is fine and the error only occurs as I specify the extension. If the extension is set to 'none' it is finding the correct image and processes it until there is an error with saving the image.

I have double checked the working directory and the image name, they are both fine.

Below is my code with some comments in case this is useful:

setwd("C:/Users/Janis/Desktop/Uni/MSc Zoologie/Masterarbeit/MORPHOMETRIE/patternize-test/subfolder")

#check if directory works - yes! i can write this file into the directory
df <- data.frame(c('a', 'a', 'a'), c('b', 'a', 'c'))
colnames(df) <- c('A', 'ABC')
write.table(df, "df_test.txt", sep='\t', quote = F, row.names = F)

#install/load packages
install.packages("devtools")
library(devtools)
install_github("StevenVB12/patternize")
install_github("zarquon42b/Morpho")

library(shiny)
library(imager)
library(magick)
library(raster)
library(sp)
library(rgdal)
library(installr)
library(patternize)

IDlist <- c('20210426_000354.jpg', '20210426_002718.jpg')
extension <- '.jpg'

#this does not work although working directory and image name are properly specified
#gives the error: "cannot find image error"Error in wrap.url(file, load.image.internal) : File not found"
colorChecker(IDlist,
             extension = extension,
             patchSize = 0.5)

#if extension needs to be NULL, the image is calibrated, but i cannot save the image
#error: "Error in imager::save.image(imCal, paste(IDlist[n], "_calibrated", extension,  : 
#Unsupported output file format. Use jpg/png or install ImageMagick"
  #as far as i understand, "ImageMagick" is now "magick", which is loaded. 
  #imager works, see below
colorChecker(IDlist,
             extension = NULL,
             patchSize = 0.5)

#testing the imager::save.image function - this works, image is created in the wd
test.image <- load.image('20210426_000354.jpg')
save.image(test.image, "test_image.jpg")

Thank you, Janis

janisuser avatar Jul 25 '21 19:07 janisuser

Hey Janis,

Could you send me the images as well. I'll give it a try..

Steven

-------- Original message -------- From: janisuser @.> Date: 7/25/21 9:31 PM (GMT+01:00) To: StevenVB12/patternize @.> Cc: "Steven M. Van Belleghem" @.>, Comment @.> Subject: Re: [StevenVB12/patternize] Image calibration - unsupported output file format (#26)

Hi Steven,

The working directory is fine and the error only occurs as I specify the extension. If the extension is set to 'none' it is finding the correct image and processes it until there is an error with saving the image.

I have double checked the working directory and the image name, they are both fine.

Below is my code with some comments in case this is useful:

setwd("C:/Users/Janis/Desktop/Uni/MSc Zoologie/Masterarbeit/MORPHOMETRIE/patternize-test/subfolder")

#check if directory works - yes! i can write this file into the directory df <- data.frame(c('a', 'a', 'a'), c('b', 'a', 'c')) colnames(df) <- c('A', 'ABC') write.table(df, "df_test.txt", sep='\t', quote = F, row.names = F)

#install/load packages install.packages("devtools") library(devtools) install_github("StevenVB12/patternize") install_github("zarquon42b/Morpho")

library(shiny) library(imager) library(magick) library(raster) library(sp) library(rgdal) library(installr) library(patternize)

IDlist <- c('20210426_000354.jpg', '20210426_002718.jpg') extension <- '.jpg'

#this does not work although working directory and image name are properly specified #gives the error: "cannot find image error"Error in wrap.url(file, load.image.internal) : File not found" colorChecker(IDlist, extension = extension, patchSize = 0.5)

#if extension needs to be NULL, the image is calibrated, but i cannot save the image #error: "Error in imager::save.image(imCal, paste(IDlist[n], "_calibrated", extension, : #Unsupported output file format. Use jpg/png or install ImageMagick" #as far as i understand, "ImageMagick" is now "magick", which is loaded. #imager works, see below colorChecker(IDlist, extension = NULL, patchSize = 0.5)

#testing the imager::save.image function - this works, image is created in the wd test.image <- load.image('20210426_000354.jpg') save.image(test.image, "test_image.jpg")

Thank you, Janis

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/26#issuecomment-886247236, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC44CQP5RXDUMDJ4DIITTZRRANANCNFSM5A53DX6Q.

StevenVB12 avatar Jul 25 '21 21:07 StevenVB12

Hallo,

Janis Czurda @.***) hat Sie eingeladen, den Ordner „ test_images “ in Dropbox zu bearbeiten.

Janis Czurda schreibt dazu: „hi Steven! here are the two images, they were too large to send via email“

1 Viel Spaß! Das Dropbox-Team

janisuser avatar Jul 25 '21 22:07 janisuser

Hi Steven,

I believe my previous E-Mails have not reached you as the image sizes were too large. I have now created a shared drop box folder - think you should have already received an invitation.

Many thanks for your help! Best wishes,

Janis

Am So., 25. Juli 2021 um 23:50 Uhr schrieb Steven M. Van Belleghem < @.***>:

Hey Janis,

Could you send me the images as well. I'll give it a try..

Steven

-------- Original message -------- From: janisuser @.> Date: 7/25/21 9:31 PM (GMT+01:00) To: StevenVB12/patternize @.> Cc: "Steven M. Van Belleghem" @.>, Comment @.> Subject: Re: [StevenVB12/patternize] Image calibration - unsupported output file format (#26)

Hi Steven,

The working directory is fine and the error only occurs as I specify the extension. If the extension is set to 'none' it is finding the correct image and processes it until there is an error with saving the image.

I have double checked the working directory and the image name, they are both fine.

Below is my code with some comments in case this is useful:

setwd("C:/Users/Janis/Desktop/Uni/MSc Zoologie/Masterarbeit/MORPHOMETRIE/patternize-test/subfolder")

#check if directory works - yes! i can write this file into the directory df <- data.frame(c('a', 'a', 'a'), c('b', 'a', 'c')) colnames(df) <- c('A', 'ABC') write.table(df, "df_test.txt", sep='\t', quote = F, row.names = F)

#install/load packages install.packages("devtools") library(devtools) install_github("StevenVB12/patternize") install_github("zarquon42b/Morpho")

library(shiny) library(imager) library(magick) library(raster) library(sp) library(rgdal) library(installr) library(patternize)

IDlist <- c('20210426_000354.jpg', '20210426_002718.jpg') extension <- '.jpg'

#this does not work although working directory and image name are properly specified #gives the error: "cannot find image error"Error in wrap.url(file, load.image.internal) : File not found" colorChecker(IDlist, extension = extension, patchSize = 0.5)

#if extension needs to be NULL, the image is calibrated, but i cannot save the image #error: "Error in imager::save.image(imCal, paste(IDlist[n], "_calibrated", extension, : #Unsupported output file format. Use jpg/png or install ImageMagick" #as far as i understand, "ImageMagick" is now "magick", which is loaded. #imager works, see below colorChecker(IDlist, extension = NULL, patchSize = 0.5)

#testing the imager::save.image function - this works, image is created in the wd test.image <- load.image('20210426_000354.jpg') save.image(test.image, "test_image.jpg")

Thank you, Janis

— You are receiving this because you commented. Reply to this email directly, view it on GitHub< https://github.com/StevenVB12/patternize/issues/26#issuecomment-886247236>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/ABQOC44CQP5RXDUMDJ4DIITTZRRANANCNFSM5A53DX6Q

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/StevenVB12/patternize/issues/26#issuecomment-886262404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU6XWRJ7ATP3ZIOJY3NE7RLTZSBKJANCNFSM5A53DX6Q .

janisuser avatar Jul 25 '21 22:07 janisuser

Hi Janis,

this fixed it for me:

IDlist <- c('20210426_000354', '20210426_002718')
extension <- '.jpg'

The extension should not be in the IDlist.

Let me know how it goes!

Steven

StevenVB12 avatar Jul 26 '21 10:07 StevenVB12

Hi Steven,

Thank you, this fixes it for me, too (though I could swear I tried this several times before without any effect).

Thanks again,

Janis

janisuser avatar Jul 28 '21 06:07 janisuser

I am having this same issue when I try to run colorChecker.

For example, The following code generates an error: "Error in wrap.url(file, load.image.internal) : File not found" IDlist <- c('JOS-1', 'JOS-2') extension <- '.jpg' colorChecker(IDlist, extension)

But the code below does run (the directory and filenames are correct), but then I get the unsupported file format error at the saving step: IDlist <- c('JOS-1.jpg', 'JOS-2.jpg') colorChecker(IDlist)

Any further suggestions on what to try here?

stephen1694 avatar Jun 01 '22 20:06 stephen1694

Does your working directory contain the images?

Steven

From: stephen1694 @.> Sent: Wednesday, June 1, 2022 4:55 PM To: StevenVB12/patternize @.> Cc: Steven M. Van Belleghem @.>; Comment @.> Subject: Re: [StevenVB12/patternize] Image calibration - unsupported output file format (#26)

I am having this same issue when I try to run colorChecker.

For example, The following code generates an error: "Error in wrap.url(file, load.image.internal) : File not found" IDlist <- c('JOS-1', 'JOS-2') extension <- '.jpg' colorChecker(IDlist, extension)

But the code below does run (the directory and filenames are correct), but then I get the unsupported file format error at the saving step: IDlist <- c('JOS-1.jpg', 'JOS-2.jpg') colorChecker(IDlist)

Any further suggestions on what to try here?

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/26#issuecomment-1144124640, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC46TGGFVSPGKNVTYAFLVM7EYXANCNFSM5A53DX6Q. You are receiving this because you commented.Message ID: @.@.>>

StevenVB12 avatar Jun 01 '22 20:06 StevenVB12

Yes, I set my working directory as the folder with the images before running this code.

stephen1694 avatar Jun 01 '22 21:06 stephen1694

Please share me your two images when you have a chance for me to try.

Steven

From: stephen1694 @.> Sent: Wednesday, June 1, 2022 5:39 PM To: StevenVB12/patternize @.> Cc: Steven M. Van Belleghem @.>; Comment @.> Subject: Re: [StevenVB12/patternize] Image calibration - unsupported output file format (#26)

Yes, I set my working directory as the folder with the images before running this code.

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/26#issuecomment-1144164297, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC42LAEU3GOMYO4IYWNTVM7J5RANCNFSM5A53DX6Q. You are receiving this because you commented.Message ID: @.@.>>

StevenVB12 avatar Jun 01 '22 22:06 StevenVB12

JOS-2 JOS-1

stephen1694 avatar Jun 01 '22 22:06 stephen1694

Ok. Not sure why this is happening, but the function is having problems with not setting the prepath.

It should run like this:

colorChecker(IDlist, prepath = NULL, extension)

Let me know!

Steven

From: stephen1694 @.> Sent: Wednesday, June 1, 2022 6:19 PM To: StevenVB12/patternize @.> Cc: Steven M. Van Belleghem @.>; Comment @.> Subject: Re: [StevenVB12/patternize] Image calibration - unsupported output file format (#26)

[JOS-2]https://user-images.githubusercontent.com/66315990/171511109-27ef74ea-fdb5-466a-9f5f-89f7b89c659e.JPG [JOS-1]https://user-images.githubusercontent.com/66315990/171511112-94d5c9aa-3937-451b-ab99-6b2f2c0534ec.JPG

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/26#issuecomment-1144199013, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC42TUTFI72YF2WZAA7DVM7OUJANCNFSM5A53DX6Q. You are receiving this because you commented.Message ID: @.@.>>

StevenVB12 avatar Jun 01 '22 22:06 StevenVB12

It's running now, thank you for your quick help!

stephen1694 avatar Jun 02 '22 13:06 stephen1694