title: How can I limit the number of characters output at a time for image to ASCII converter to output in discord with 2000 character limit per message
body: <p>I have an image to ASCII converter working with a discord bot so people can send it an image, it downloads it and converts it to ASCII and sends it back to them, but since Discord limits messages to 2000 characters each it often gets stuck making images of reasonable size.</p>
  <p>I used <a href="https://youtu.be/v_raWlX7tZY" rel="nofollow noreferrer">this</a> tutorial to convert the images and I believe this line of code:</p>
  <pre><code>asciiImage = &quot;\n&quot;.join(newImageData[i:(i + newWidth)] for i in range(0, pixelCount, newWidth))
  </code></pre>
  <p>is the one I need to fix, I believe it connects each line of the image to a newline character based off the newWidth variable, which you enter when you give it the image. How would I limit it to only add lines until the next line would go over 2000, output that (or add it to a list) and then repeat until it has finished the image?</p>
  <p>Sorry if this is a bit confusing.</p>