Description Usage Format Value Methods Examples
An EBImage wrapper with integrated history tracking.
1 |
R6Class
object.
Object of R6Class
with manipulation functions.
The user should not need to create an action object. This is a class used exclusively by a shinyimg to keep track of a set of changes.
set_autodisplay()
Turns on automatic rendering of image. User must still initially call render() to display image
set_autodisplay_OFF()
Turns off automatic image rendering
new(img)
Default constructor. img
can be either a URL or a location of a local image.
undo()
Undoes the last change done to this image. When the original image state is reached, no more undos are possible.
redo()
Redos the next action after an undo has been performed. Will no longer redo if there are no more undos to redo.
shinyUndo()
Undoes the last change done to this image without autorendering; used by Shiny. When the original image state is reached, no more undos are possible.
redo()
Redos the next action after an undo has been performed without autorendering; used by Shiny. Will no longer redo if there are no more undos to redo.
toggle_ll()
Returns status of lazy loading.
copy()
Returns a copy of the image.
add_brightness()
Adds brightness to the image.
remove_brightness()
Removes brightness (darkens) to the image.
add_contrast()
Adds contrast to the image.
remove_contrast()
Removes contrast from the image.
add_gamma()
Adds gamma correction to the image.
remove_gamma()
Remoevs gamma correction from the image.
add_blur()
Adds blur to the entire photo.
remove_blur()
Removes blur from the entire photo.
add_rotate()
Rotates image to the right.
remove_rotate()
Rotates image to the left.
set_brightness()
Sets the brightness of the image by number inputted.
set_contrast()
Sets the contrast of the image by number inputted.
set_gamma()
Sets the gamma correction of the image by number inputted.
set_blur()
Sets the blur of the image by number inputted.
set_rotate()
Sets the degree of rotation of the image by number inputted.
set_grayscale((num))
Sets the image to grayscale if 1 is inputted; Reverts the image back to colormode if 0 is inputted
crop()
Uses locator to get corners of an image. Automatically finds min and max coordinates. After two points are selected, a cropping selection can be create in order to crop the image to the desired size.
cropxy()
Performs same action as crop but it is used by Shiny and the parameters are different.
get_raw()
Gets the raw matrix slices of the current image.
gethistory()
Returns a copy of the members of the shinyimg object stored in myhistory.
get_brightness()
Returns a copy of the value stored for brightness.
get_contrast()
Returns a copy of the value stored for contrast.
get_gamma()
Returns a copy of the value stored for gamma correction.
get_blur()
Returns a copy of the value stored for blur.
get_rotate()
Returns a copy of the value stored for rotation.
get_color()
Returns a copy of the value stored for grayscale/colormode.
get_imghistory()
Returns a copy of the list of image histories.
get_actions()
Returns a copy of the list of the input parameters.
checkRedo()
Returns a bool value to check the status of available Redoes; used by Shiny.
save(filepath)
Saves the current state to be resumed later. filepath
has a default value of 'workspace.si'
saveImage(filepath)
Saves a jpg of the image.
load(filepath)
Loads a previously saved state. filepath
has a default value of 'workspace.si'
size()
Returns the current image dimentions.
render()
Renders the current image.
toggle_render()
Toggles the automatic rendering after making a change. By default, this option is off.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | small_tiger = shinyimg$new(system.file("images","tiger_small.jpg",package="ShinyImage"))
small_tiger$add_brightness() # Adds brightness to image
small_tiger$undo() # Undoes the brightness addition
small_tiger$redo() # Redoes the brightness addition
small_tiger$add_contrast() #Adds contrast to image
small_tiger$remove_contrast() #Removes the contrast from the image
small_tiger$add_gamma() #Adds Gamma correction
small_tiger$remove_gamma() #Removes the Gamma Correction
small_tiger$add_blur() #Adds blur to image
small_tiger$remove_blur() #removes the blur from the image
small_tiger$add_rotate() #Adds rotation by 1 degree
small_tiger$remove_rotate() #Remoes the rotation by 1 degree
small_tiger$set_brightness(.5) #Sets brightness by number inputted
small_tiger$set_contrast(2) #Sets contrast by number inputted
small_tiger$set_gamma(2) #Sets gamma by number inputted
small_tiger$set_blur(6) #sets blurring to number inputted
small_tiger$set_rotate(180) #sets rotationt to degrees inputted
small_tiger$set_grayscale(1) #changes image to colormode
small_tiger$set_grayscale(0) #reverts back to colormode
small_tiger$cropxy(0,10,0,10) #crops by the coordinates inputted
small_tiger$undo #undoes the crop
small_tiger$gethistory() #returns recorded changes to image
small_tiger$save('save.si') # Saves the current state. The filename is optional.
small_tiger$saveImage('temp.jpg') #Saves current image to jpg file
small_tiger$load('save.si') # Loads from a previously saved state. The filename is optional.
#Requires a previously instantiated shinyimg instance (argument provided to new can be null).
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.