Function Repository Resource:

GetLoremFlickrImage

Source Notebook

Get random LoremFlicker free Creative Commons (CC) images

Contributed by: Daniel de Souza Carvalho

ResourceFunction["GetLoremFlickrImage"][]

retrieves a random 800 x 600 image.

ResourceFunction["GetLoremFlickrImage"][size]

retrieves a random square image with as specific size.

ResourceFunction["GetLoremFlickrImage"][text]

retrieves an image related to the text query text.

ResourceFunction["GetLoremFlickrImage"][text,size]

retrieves an image according the text query text and with specified size.

Details

Images can be obtained for specified query and sizes.
The argument text should be a string or a list of strings.
The size specification can be a single number for a square image, or a list of the form {width,height}.
The image size specification should be given using integers.
ResourceFunction["GetLoremFlickrImage"] typically returns different images when the same request is repeated.
As this function uses an external web API, the performance depends on your connection quality.
Your firewall should allow HTTP/S requests.
There are watermarks in the images with the type of licence (top) and author (below).

Examples

Basic Examples (6) 

Get a random 800 x 600 image:

In[1]:=
ResourceFunction["GetLoremFlickrImage"][]
Out[1]=

Get a random 800 x 600 image text query based:

In[2]:=
ResourceFunction["GetLoremFlickrImage"]["soldier"]
Out[2]=

Get a random 800 x 600 image query with a list of words:

In[3]:=
ResourceFunction["GetLoremFlickrImage"][{"earth", "space"}]
Out[3]=

Get a square random image of specified size:

In[4]:=
ResourceFunction["GetLoremFlickrImage"][300]
Out[4]=

Get a image with a simple text query specifying the image size:

In[5]:=
ResourceFunction["GetLoremFlickrImage"]["car in NYC", {350, 400}]
Out[5]=

Get a image with a list of text query specifying the image size:

In[6]:=
ResourceFunction["GetLoremFlickrImage"][{"car", "police"}, {350, 400}]
Out[6]=

Applications (3) 

Create a pure function and get images for a list of random words:

In[7]:=
imageList = {#, ResourceFunction["GetLoremFlickrImage"][#, 300]} & /@ RandomWord[10]
Out[7]=

Use machine learning to identify image content:

In[8]:=
{#[[1]], #[[2]], ImageIdentify[#[[2]]]} & /@ imageList // Grid[#, Frame -> All] &
Out[8]=

It is possible to use the computer vision algorithms:

In[9]:=
ResourceFunction["GetLoremFlickrImage"]["friends"]
Out[9]=

Detect facial features with machine learning:

In[10]:=
FacialFeatures[%] // Dataset
Out[10]=

It is possible to apply image processing functions:

In[11]:=
ResourceFunction["GetLoremFlickrImage"]["objects"]
Out[11]=
In[12]:=
ColorNegate[EdgeDetect[Blur[%, 5], 5]]
Out[12]=

Neat Examples (3) 

It is possible to send queries in many languages such as Portuguese:

In[13]:=
ResourceFunction["GetLoremFlickrImage"]["Carnaval"]
Out[13]=

Another example of query in Portuguese:

In[14]:=
ResourceFunction["GetLoremFlickrImage"]["Praia"]
Out[14]=

Another query in Portuguese:

In[15]:=
ResourceFunction["GetLoremFlickrImage"]["Favela"]
Out[15]=

Publisher

Daniel de Souza Carvalho

Version History

  • 1.0.1 – 10 July 2024
  • 1.0.0 – 09 April 2020

Source Metadata

Related Resources

Author Notes

It is not guaranteed to obtain the same image running the query repetitively

License Information