See an image in the gray scale

#1

see an image in the gray scale.

I have a doubt. I’m working with an image but I want to know why I can not see it fast “in automatic”
without writing

ImageView.imshow (ImageFromTestImages)
[(This is to see a color image but I want to see the image in gray)]

this is the line of code

ImageFromTestImagesGray = Images.Gray. (ImageFromTestImages)

Could someone help me to see the image in gray?

0 Likes

#2

I do not think the color of the image has any relevance here.

Two possibilities:

  • Use Atom, it automatically displays images (Jupyter Notebook may work as well)
  • Define a helper macro
using ImageView
macro imshow(img)
    return :(ImageView.imshow($img))
end
@imshow img
1 Like

#3

I’m not sure I understand the question, since I think you answered it yourself: imshow(Gray.(img)).

0 Likes

#4

I’m working on this.
import Images
import TestImages
import ImageMetadata
import ImageAxes
import ImageDraw
import ImageView
import ImageTransformations
import ImageFiltering

ImageFromTestImages = TestImages.testimage("lighthouse")
ImageView.imshow(ImageFromTestImages)
ImageFromTestImagesGray = Images.Gray.(ImageFromTestImages)

But I see that many people say that when putting:

import Images
ImageFromTestImages = TestImages.testimage (“lighthouse”)

the default image appears without putting
imshow (img)

0 Likes

#5

I’m not sure what you want to achieve. Please clearly describe the output you want, and the environment you’re working in (Juno? Jupyter? Terminal?). Additionally, if you’re working interactively, you can load functions more easily with using Images, TestImages, ImageView, since Images.jl already exports a bunch of functionality from all the other packages you’ve imported.

1 Like