SexScripts : Images - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=472 Page 1 of 1

Images

Liz [ Thu Mar 26, 2015 6:22 pm ]

I have 2 questions that I can't see the answer for...

If I'm displaying an image taken from a webcam, it typically takes up a lot of the screen. Is there a way to display it making it a different size, e.g. 30% of the screen width with setImage()?.

Also was curious if there is a delete function for sendImage() to remove an image from the server? The communications API is still a bit new so may just not have it in the docs yet?

Thanks

Re: Images

doti [ Thu Mar 26, 2015 6:42 pm ]

The image taken with the webcam should be as close from 800px width as possible, so generaly no more than 1024px width. You're right it may be a problem however.
On the server, there is a picture reduction for very big (bytes) pictures.

There's no deletion of picture for now ; it should not be a problem, as you need to know the code (if you save the code, you can also save the picture). On the opposite, there's no backup (unlike other data) against vandalism.

Re: Images

Liz [ Wed May 20, 2015 10:46 am ]

Liz wrote:
If I'm displaying an image taken from a webcam, it typically takes up a lot of the screen. Is there a way to display it making it a different size, e.g. 30% of the screen width with setImage()?.


Think I cracked it, written a quick function so I can display the webcam image at 50% (Thanks Wololo for the advanced example) will make better later:

Code:
def setImageSize = { picture, psize ->
  if (picture == null) {
    setImage(null)
    return
  }
  def image = java.awt.Toolkit.getDefaultToolkit().getImage("images/"+picture)
  def width = image.getWidth()
  def height = image.getHeight()
   
  def frameBuffer = new java.awt.image.BufferedImage( (int)((width*psize)/10), (int)((height*psize)/10),java.awt.image.BufferedImage.TYPE_4BYTE_ABGR)
  def sprite = javax.imageio.ImageIO.read(new File("images/"+picture))
  java.awt.Graphics2D graphics = frameBuffer.createGraphics()
  graphics.drawImage(sprite, 0, 0, (int)((width*psize)/10), (int)((height*psize)/10), null)
  setImage(frameBuffer, false)
}


And in my test, calling it
Code:
setImageSize(TempImg,5)
all worked fine. The problem I get is copying it into the subcontrol_control script. It stops with the "Error java.lang.RuntimeException: Deprecated". This appears to be caused by having the setInfos(6... instead of setInfos(4..

So Doti is there a better way to do this that ver 6 likes or can I disable the error message as the script uses functions from API 6 so am not wanting to set the setInfos to 4?

Re: Images

doti [ Thu May 21, 2015 10:06 am ]

Yes ; it is related to Android release (no AWT).

You should provide a byte[] to setImage instead (setImage(byte[] array,int useless) ). It will used as this :
Code:
... new ImageIcon(byteArrayYouSent) ...

Re: Images

Liz [ Thu May 21, 2015 11:12 am ]

Quote:
You should provide a byte[] to setImage instead (setImage(byte[] array,int useless) ).


Sorry, not a programmer and totally thrown by that :oops: , so for the example above do I cast (if thats the right name) frameBuffer to an array of byte making the last line something like:
Code:
setImage((byte[])frameBuffer, 0)


Not that the above works :roll: or should I be be defining the frameBuffer differently.. ..not feeling too clever today :(

Re: Images

doti [ Thu May 21, 2015 11:35 am ]

Approx. :
Code:
def frameBuffer = new java.awt.image.BufferedImage(...
...
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream()
javax.imageio.ImageIO.write(frameBuffer, "jpg", baos)
setImage(baos.toByteArray(),0)

Re: Images

Liz [ Thu May 21, 2015 11:45 am ]

Thanks, that does the trick :-)

Re: Images

Liz [ Wed May 27, 2015 11:13 pm ]

So for people reading this.. look at subcontrol_control for an example of it being used. Also note the second to last line of the function should read "png" not "jpg" to work on Linux.

Re: Images

doti [ Mon Aug 17, 2015 2:15 pm ]

Notice (Android) : when in scripts using some additional java functions to open a file, I recommand from now set the path to an absolute folder explicitely, with this expression : System.getProperty("user.dir").

That is, from :
Code:
def image = java.awt.Toolkit.getDefaultToolkit().getImage("images/"+picture)

To :
Code:
def image = java.awt.Toolkit.getDefaultToolkit().getImage(System.getProperty("user.dir")+"/images/"+picture)

Re: Images

SmokingIsSexy [ Fri May 14, 2021 7:24 am ]

doti wrote:
There's no deletion of picture for now ; it should not be a problem, as you need to know the code (if you save the code, you can also save the picture). On the opposite, there's no backup (unlike other data) against vandalism.

When will such an option be added?
I think it is important for user data privacy purposes:
Once a script has deleted the image code for an image, there is no way anymore for anyone to retrieve that image via a script, but there is also no way anymore for the script author or for the site admin to tell which image came from which user. So, if a user, who is a resident of the EU, asks for all his images to be deleted, then the site must obey such a request to conform with EU-laws, but as it has no way to know which images might belong to the user, it can't do so, except for deleting the images of ALL users that are stored in the database.

So I think that scripts should have the ability to delete all images that they no longer track i.e. via a deleteImage(string code) function.

Re: Images

doti [ Tue May 18, 2021 1:44 pm ]

The unused picture are automatically reduced then deleted after a few weeks.

You are not supposed to put your real identity anywhere when you are using SexScripts. If you are reaching this website from the EU, you may have to refrain from sending any picture of yourself allowing your identification.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
https://ss.deviatenow.com:443/
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2011