Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Solved
    • Unsolved
    • Search
    1. Home
    2. imik
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    imik

    @imik

    0
    Reputation
    7
    Posts
    16
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    imik Follow

    Best posts made by imik

    This user hasn't posted anything yet.

    Latest posts made by imik

    • RE: Boustrophedonic typesetting

      Thank you @gferreira! This is a nice example 🙂
      Also a great motivation to spent a bit more time on writing well structured code. My scripts tend to get messy very quickly. 😂

      posted in Code snippets
      imik
      imik
    • RE: newDrawing() size?

      You need to specify the size of the new canvas after each newDrawing()

      for i in range(10):
          newDrawing()
          size("A4")
          fill(random())
          rect(0, 0, width(), height())
          saveImage(f'~/Desktop/file-{i}.pdf')
          endDrawing()
      
      posted in General Discussion
      imik
      imik
    • RE: Context leak detected — some help?

      Hi @frederik,
      I am running macOS version 10.14.6 and the simplified script works perfectly fine on my machine as well.
      As I was trying to extend it I got the same output again and I did some trial and error.

      What am I trying to achieve?
      I have in mind a setup where I draw an ImageObject. The ImageObject then can contain text or graphics as well as another image. I then feed it into some arbitrary function to manipulate it.
      The clue is that I want to manipulate the manipulated image again. So I am currently returning a new ImageObeject from the manipulation function.

      I came up with something like this:

      w = h = 300
      # higher Numbers here result in the context leak
      numManipulations = 20
      
      def manipulateImage(img, r, angle, pos):
          tempImg = ImageObject()
          x, y = pos
      
          with tempImg:
              size(w, h)
              # Draw the old Image
              image(img, (0, 0))
              fill(None)
              stroke(0)
              # Draw the manipulation on top
              oval(x - r, y - r, r * 2, r * 2)
              clipPath()
              rotate(angle, center = (x, y))
              image(img, (0, 0))
              
          return(tempImg)
      
      im = ImageObject()
      
      with im:
          size(w, h)
          fill(1)
          rect(0, 0, w, h)
          fill(0)
          fontSize(100)
          text("Heee", (10, 10))
      
      for a in range(numManipulations):
          r = randint(20, 40)
          x = randint(r, w-r)
          y = randint(r, h-r)
          angle = randint(0, 360)
          im = manipulateImage(im, r, angle, (x, y))
          
          newPage(w, h)
          image(im, (0, 0))
      
          saveImage(f"~/Desktop/test/RotatingImage-{a}.png")    
          
      

      What I found out so far:

      • The scripts runs fine when you only save the final image.
        Nope, running 100 repetitions results in the same Context leak

      • When I am trying to save every step for animation purpose or so I will get Context leak deteced, msgtracer -1. No matter using gif, mp4 or png for later stitching.
        With png it usually starts at around 12 repetitions, mp4 or gif can go up to 100 repetitions, but I guess it depends on the resolution and other factors.

      • Running the script within the app you see no problem except on a lot of repetitions the app freezes at some point and you need to kill it. Running the same script then in Terminal you see the Context leak deteced, msgtracer -1.

      Maybe it is not the best setup for what I have in mind, but I hope one can understand what's happening.
      Any input for improvment is much appreciated as well. 🙂

      posted in Code snippets
      imik
      imik
    • Context leak detected — some help?

      Hi,
      I am currently working on a rather simple script what should end in an animation export. To boost things up I am running the final script in the Terminal, but right now I am stuck with an error: Context Leak detected, msgtracer returned -1 which gives me some insight why DrawBot kept crushing on this script. 😄

      For the setup:
      I want to generate an ImageObject() which will
      then be rotated, for that I wrote my own function

      def drawRotatedImage(img, angle, pos):
          x, y = pos
          oval(x - r, y - r, r * 2, r * 2)
          clipPath()
          rotate(angle, center = (x, y))
          image(img, (0, 0))
      

      I setup my own ImageObject

      im = ImageObject()
      with im:
          size("A3")
          # Drawing
      

      And then call the animation setup as follows:

      for frame in range(numFrames):
          newPage("A3")
          drawRotatedImage(im, angle, pos)
          # call the function bunch of times
      

      I narrowed it down that the problem lies somewhere within drawRotatedImage() and I think it has something to do with drawing the image object within this function. But at the moment I am lost on how I could fix this problem.

      Any help and explanation on this problem will be much appreciated! 🙂

      posted in Code snippets
      imik
      imik
    • RE: Saving Image with different ColorProfile

      Hey @frederik
      Thank you very much for your reply.
      I did some quick tests with the code you provided but it seems I have not achieved any positive result in saving the pages with the provided color profile data.
      The results were always GenericRGB for TIFF, JPG and PNG regardless of me also using some other ICC files.

      dataWithContentsOfFile_ returns an objective-c class NSConcreteData with the data represented as b'…' in it, what I guess is right and what imageColorSyncProfileData needs.

      Anyway, thanks again for your help. 🙂

      posted in General Discussion
      imik
      imik
    • RE: Saving Image with different ColorProfile

      Hey @gferreira,
      thank you for you reply! I will have a more detailed look into the PIL-Library but I think that's it for the moment. 🙂
      Still, if you have some further information or any idea where to find something about the imageColorSyncProfileData and how to use it that would be great! Always happy to learn something new.

      Have a great day. 🙂

      posted in General Discussion
      imik
      imik
    • Saving Image with different ColorProfile

      Hello,
      I am stuck with a problem where I try to open an image in ImageObject() apply a .dotScreen filter on it and save it again.
      Now I always end up with an image saved with RGB profile but I would like to generate an image just black and white — no color information.
      I looked into the documentation and first I thought it has something to do with colorSpace() but I guess that is not the case.
      So I ended up by the saving options and I think that imageColorSyncProfileData is actually what I am looking for. But I do not understand how to work with it.

      For further interest I would be keen to know if there is a way to convert images into different profiles. Especially thinking about print production where I maybe need certain ICC-Profiles.

      I am happy for any help or information for a solution.
      Thank you.

      posted in General Discussion
      imik
      imik