Add image shortcut

edited August 2013 in General
Hello,
for my design, I need to add a lot of images to my gds file, then resize them and finally place them on precise positions. As the "add image" button is hidden in the menu, this step is time consumming. I have a proposition, would it be possible to add a shortcut for "add image" or better, is it possible to change the code such a way I can select all my pictures and add them at once.

Thanks a lot in advance,
Mo

Comments

  • edited November -1
    Momo,

    You can set a bindkey for that task :
    [File][Setup][Key Bindings] in the MainMenu, you will find edit_menu.add image or Add Image
    on the left, you add your Keyboard Shortcut : Ctrl+K or Shift+I or even only E (I noticed they are not used)

    I should be faster.

    Best regards,

    Laurent
  • edited August 2013

    Hi Laurent,

    thank you for the remark :-)

    I'd like to add that it is possible to create images with Ruby scripts - that requires some learning but is probably the most efficient way to solve that problem.

    Matthias

  • edited September 2013
    Hi Matthias,

    I also am loading volumes of images into gds files. Would you you be willing to provide an example of the relevant ruby command to import an image from a given path, with a given scaling, offset, rotation? Or point me towards the info?

    I am getting the following error:

    myimage = Image.new("image.jpg")
    Ruby error: '(eval): uninitialized constant Image' (NameError)
    (eval)

    Best,
    Loren
  • edited September 2013

    Hi Loren,

    here is the basic code:

    view = RBA::Application.instance.main_window.current_view
    image = RBA::Image::new("/home/matthias/Pictures/IMAGE.JPG")
    
    # TODO: set image.trans to establish a pixel-to-layout space conversion
    
    view.insert_image(image)
    

    As the comment says, you'll have to specify a transformation to define scaling and offset. There are numerous ways to do so, depending on the complexity you require. The "trans=" method specifies a simple, affine transformation (without shear and anisotropic scaling). "matrix=" allows to specify a full 3x3 matrix which includes these options plus perspective distortion. See http://www.klayout.de/doc/code/class_Image.html for details about these methods and further information.

    Both transformations convert pixel coordinates to micron units. Hence a scaling of 0.5 effectively means a pixel size of 0.5 micron. The displacement specifies the location of the center of the image.

    Matthias

  • edited November -1
    Thank you Matthias,
    I have now imported several hundred images this way and am very glad I did not do so by hand :)
    Loren
Sign In or Register to comment.