IMAGE ADJUST LISP?

IMAGE ADJUST LISP?

rob.aHH2T8
Enthusiast Enthusiast
640 Views
6 Replies
Message 1 of 7

IMAGE ADJUST LISP?

rob.aHH2T8
Enthusiast
Enthusiast

Does anyone have a LISP for adjusting an image with Properties-Image Adjust?  (brightness/ contrast/ fade)acad image adjust.JPG

0 Likes
Accepted solutions (1)
641 Views
6 Replies
Replies (6)
Message 2 of 7

rkmcswain
Mentor
Mentor

Should be pretty trivial

 

rkmcswain_0-1654790314594.png

 

 

Have you started writing something or just looking for something existing?

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 7

ВeekeeCZ
Consultant
Consultant

Now I do. The values offered by prompts are from the first img of selection. So if you want to match values of one to many, select the one by a single click, then the rest.

 

(defun c:ImageAdj ( / s o b c f i e)

  (if (and (setq s (ssget "_:L" '((0 . "IMAGE"))))
	   (setq b (cond ((getint (strcat "\nBrightness <" (itoa (setq o (getpropertyvalue (ssname s 0) "Brightness"))) ">: "))) (o)))
	   (setq c (cond ((getint (strcat "\nContrast <" (itoa (setq o (getpropertyvalue (ssname s 0) "Contrast"))) ">: "))) (o)))
	   (setq f (cond ((getint (strcat "\nFade <" (itoa (setq o (getpropertyvalue (ssname s 0) "Fade"))) ">: "))) (o)))
	   )
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (setpropertyvalue e "Brightness" b)
      (setpropertyvalue e "Contrast" c)
      (setpropertyvalue e "Fade" f)))
  (princ)
  )

 

Message 4 of 7

rob.aHH2T8
Enthusiast
Enthusiast

Looking for a solution, so I don't have to adjust it manually every time.

0 Likes
Message 5 of 7

rob.aHH2T8
Enthusiast
Enthusiast

Thanks!  Where do I put in the values?  (b=30, c=70, f=50)

0 Likes
Message 6 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution

Hardcoded:

 


@ВeekeeCZ wrote:

...

 

(defun c:ImageAdj ( / s o b c f i e)

  (if (and (setq s (ssget "_:L" '((0 . "IMAGE"))))
	   (setq b 30)
	   (setq c 70)
	   (setq f 50)
	   )
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (setpropertyvalue e "Brightness" b)
      (setpropertyvalue e "Contrast" c)
      (setpropertyvalue e "Fade" f)))
  (princ)
  )

 


 

0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

As its hard coded why have b c f.

 

 

(defun c:ImageAdj ( / s i e)
  (if (setq s (ssget "_:L" '((0 . "IMAGE"))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (setpropertyvalue e "Brightness" 30)
      (setpropertyvalue e "Contrast" 50)
      (setpropertyvalue e "Fade" 70))
  )
  (princ)
  )

 

0 Likes