Witamy, Gość. Zaloguj się lub zarejestruj.
Czy dotarł do Ciebie email aktywacyjny?


Zaloguj się podając nazwę użytkownika, hasło i długość sesji

  Pokaż wiadomości
Strony: 1 2 [3] 4 5 ... 610
29  Hyde zone / Hyde park / Ostatki 2022! : 22.12.2022, 21:12:12
Ho ho ho!

Ja żem nie Mikołaj, ino Wasz ulubiony administrator.
Wszystkiego najlepszego z okazji końcówki Roku!

Dużo GIMP-owania na nowych przyszłych wersjach

Życzy
administracja gimpuj.info
30  Tutoriale / Wasze poradniki / Odp: Animowany Kolorowy Tekst w Stylu LED. : 03.12.2022, 08:50:55
Poprawione, wyrzucę też poprzednie post, żeby nie myliło.
31  Ogólne dyskusje / GIMP / Odp: GIMP ma teraz 27 lat : 28.11.2022, 17:18:50
Miejmy nadzieję, że nie.
32  Ogólne dyskusje / GIMP / Odp: GIMP ma teraz 27 lat : 27.11.2022, 15:03:35
Długi ten projekt
33  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 20.11.2022, 07:58:26
Wydaje się, że problemem była przezroczystość (najwyraźniej, czy zapisie do jgp jest ona automatycznie usuwana). To widać na plikach xcf.
Dodałem usuwanie przezroczystości przed zapisem do jpg.

Kod:
(define (resize-into-square image drawable)
  (gimp-image-undo-group-start image)
  (plug-in-autocrop RUN-NONINTERACTIVE image drawable)

  (let* (
      (current-width (car (gimp-image-width image)))
      (current-height (car (gimp-image-height image)))
      (square-size (if
          (or (> current-width 1490) (> current-height 1490))
          1500
          (+ (max current-width current-height) 10)
      ))
      (wanted-width (min (- square-size 10) current-width))
      (wanted-height (min (- square-size 10) current-height))
      (ratio (min (/ wanted-width current-width) (/ wanted-height current-height)))
      (width (* ratio current-width))
      (height (* ratio current-height))
    )

    (gimp-image-scale image width height)
    (gimp-image-resize image square-size square-size (/ (- square-size width) 2) (/ (- square-size height) 2))
  )

  (gimp-layer-resize-to-image-size drawable)
  (gimp-image-undo-group-end image)
  (gimp-displays-flush)
)

(define (resize-into-square-save pattern)
  (let* (
      (filelist (cadr (file-glob pattern 1)))
    )

    (while (not (null? filelist))
      (let* (
          (file-name (car filelist))
          (image (car (gimp-file-load RUN-NONINTERACTIVE file-name file-name)))
          (drawable (car (gimp-image-get-active-layer image)))
          (file-name-without-extension (unbreakupstr (butlast (strbreakup file-name ".")) "."))
        )

        (resize-into-square image drawable)

        (gimp-file-save RUN-NONINTERACTIVE image drawable (string-append file-name-without-extension ".xcf") (string-append file-name-without-extension ".xcf"))

        (gimp-layer-flatten drawable)
        (gimp-file-save RUN-NONINTERACTIVE image drawable (string-append file-name-without-extension ".jpg") (string-append file-name-without-extension ".jpg"))

        (gimp-image-delete image)
      )

      (set! filelist (cdr filelist))
    )
  )
)

(script-fu-register "resize-into-square"
    "<Image>/Script-Fu/Resize and add border"
    "Automatically adjust contrast of drawable"
    "Ziomioslaw"
    "Ziomioslaw"
    "2022"
    "*"
    SF-IMAGE "Image" 0
    SF-DRAWABLE "Current Layer" 0
)
34  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 19.11.2022, 20:20:42
No tworzy się kwadrat o boku 660x660.
Czy jak otworzysz ten sam obrazek w GIMP i wybierzesz Obraz -> Przytnij dokładnie, to ciągle obrazek będzie kwadratem?

PS. "Przytnij dokładnie" wycina także nie używane obszary (na podstawie koloru tła) z wnętrza obrazka.
35  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 19.11.2022, 10:49:58
Sprawdziłem ten skrypt, robi kwadraty dla małych obrazków. Możesz podać wymiary, które są problamatyczne?
36  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 19.11.2022, 00:10:11
Sprawdziłem, faktycznie zostały utworzone nowe pliki z tym, że plik wyjściowy nie był kwadratem.

Aha, do poprawy.

Ze zdjęciami z przezroczystym tłem png nie ma problemu, można przerabiać przez konsolę, nie ma tutaj konfliktu nazw, ich jakość jest zazwyczaj dobra. Gdy mamy a.png wychodzi a.xfc i a.jpg, natomiast przy a.jpg otrzymamy a.xfc i a.jpg, który nadpisze oryginalny plik?

Tak, zapis jest zawsze do jpg i xcf. Można to zmienić, tylko na jakie?

Jeśli Ci to nie odpowiada, po prostu dodamy parametr na nazwę, dobrze?

Możesz doprecyzować?

To chyba niepotrzebne, skoro chcesz ręcznie edytować obrazki.
Chodziło mi o nazwę pliku, do którego zostanie zapisany obrazek. Teraz jest to zawsze nazwa oryginału bez rozszerzenia.
37  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 18.11.2022, 18:43:23
Hmm, no ja myślałem, że to będzie wywoływane z konsolki.

Spróbuj tego:

Kod:
(define (resize-into-square image drawable)
  (gimp-image-undo-group-start image)
  (plug-in-autocrop RUN-NONINTERACTIVE image drawable)

  (let* (
      (current-width (car (gimp-image-width image)))
      (current-height (car (gimp-image-height image)))
      (square-size (if
          (or (> current-width 1490) (> current-height 1490))
          1500
          (+ (max current-width current-height) 10)
      ))
      (wanted-width (min (- square-size 10) current-width))
      (wanted-height (min (- square-size 10) current-height))
      (ratio (min (/ wanted-width current-width) (/ wanted-height current-height)))
      (width (* ratio current-width))
      (height (* ratio current-height))
    )

    (gimp-image-scale image width height)
    (gimp-image-resize image square-size square-size (/ (- square-size width) 2) (/ (- square-size height) 2))
  )

  (gimp-image-undo-group-end image)
  (gimp-displays-flush)
)

(define (resize-into-square-save pattern)
  (let* (
      (filelist (cadr (file-glob pattern 1)))
    )

    (while (not (null? filelist))
      (let* (
          (file-name (car filelist))
          (image (car (gimp-file-load RUN-NONINTERACTIVE file-name file-name)))
          (drawable (car (gimp-image-get-active-layer image)))
          (file-name-without-extension (unbreakupstr (butlast (strbreakup file-name ".")) "."))
        )

        (resize-into-square image drawable)
        (gimp-file-save RUN-NONINTERACTIVE image drawable (string-append file-name-without-extension ".jpg") (string-append file-name-without-extension ".jpg"))
        (gimp-file-save RUN-NONINTERACTIVE image drawable (string-append file-name-without-extension ".xcf") (string-append file-name-without-extension ".xcf"))
        (gimp-image-delete image)
      )

      (set! filelist (cdr filelist))
    )
  )
)

(script-fu-register "resize-into-square"
    "<Image>/Script-Fu/Resize and add border"
    "Automatically adjust contrast of drawable"
    "Ziomioslaw"
    "Ziomioslaw"
    "2022"
    "*"
    SF-IMAGE "Image" 0
    SF-DRAWABLE "Current Layer" 0
)

To jak umieścisz w Twoim katalogu ze skryptami (szczegóły: https://www.joelotz.com/blog/2020/batch-autocrop-png-images-in-gimp.html), to będziesz mógł potem wejść do katalogu gdzie są obrazki.

To pozwoli Ci zrobić potem w konsoli coś takiego:

Kod:
gimp -i -b '(resize-into-square-save "*.png")' -b '(gimp-quit 0)'

Uwaga: pamiętaj, że plik 'a.png' zostanie zapisany jako 'a.jpg' i 'a.xcf', więc testuj na początku na katalogu, w którym nie ma plików o innym rozszerzeniu.

Jeśli Ci to nie odpowiada, po prostu dodamy parametr na nazwę, dobrze?
38  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 18.11.2022, 12:40:52
A Ty niechciałeś tego uruchamiać na zawartości katalogu?
39  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 17.11.2022, 23:30:34
Jak wklejałem dodałem [, wystarczy usunąć. Poprawiłem.
40  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 17.11.2022, 17:54:55
Takie coś?

Kod:
(define (resize-and-add-border image drawable)
(gimp-image-undo-group-start image)
(plug-in-autocrop RUN-NONINTERACTIVE image drawable)

(let* (
(current-width (car (gimp-image-width image)))
(current-height (car (gimp-image-height image)))
(square-size (if
(or (> current-width 1490) (> current-height 1490))
1500
(+ (max current-width current-height) 10)
))
(wanted-width (min (- square-size 10) current-width))
(wanted-height (min (- square-size 10) current-height))
(ratio (min (/ wanted-width current-width) (/ wanted-height current-height)))
(width (* ratio current-width))
(height (* ratio current-height))
)

(gimp-image-scale image width height)
(gimp-image-resize image square-size square-size (/ (- square-size width) 2) (/ (- square-size height) 2))
)

(gimp-image-undo-group-end image)
(gimp-displays-flush)
)

(script-fu-register "resize-and-add-border"
"<Image>/Script-Fu/Resize and add border"
"Automatically adjust contrast of drawable"
"Ziomioslaw"
"Ziomioslaw"
"2022"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Current Layer" 0
)
41  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 16.11.2022, 22:03:39
Jeśli masz obrazek, którego obie krawędzie są mniejsze niż 1500, to zostanie wyśrodkowany. Sprawdziłem właśnie.
Może zamieść obrazek, który sprawia problemy.
42  Hyde zone / Zlecę / Kupię / Odp: Opracowanie Skyptu Script-Fu : 16.11.2022, 20:19:31
Spróbujcie teraz:

Kod:
(define (resize-and-add-border image drawable)
(gimp-image-undo-group-start image)
(plug-in-autocrop RUN-NONINTERACTIVE image drawable)

(let* (
(square-size 1500)
(current-width (car (gimp-image-width image)))
(current-height (car (gimp-image-height image)))
(wanted-width (min (- square-size 10) current-width))
(wanted-height (min (- square-size 10) current-height))
(ratio (min (/ wanted-width current-width) (/ wanted-height current-height)))
(width (* ratio current-width))
(height (* ratio current-height))
)

(gimp-image-scale image width height)
(gimp-image-resize image square-size square-size (/ (- square-size width) 2) (/ (- square-size height) 2))
)

(gimp-image-undo-group-end image)
(gimp-displays-flush)
)

(script-fu-register "resize-and-add-border"
"<Image>/Script-Fu/Resize and add border"
"Automatically adjust contrast of drawable"
"Ziomioslaw"
"Ziomioslaw"
"2022"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Current Layer" 0
)

Skaluje do max 1490 z zachowaniem proporcji, i umieszcza to w kwadracie, na środku.
Strony: 1 2 [3] 4 5 ... 610