Automated updates: 2020-12-28
This commit is contained in:
parent
63257f53bd
commit
8e86cf4d76
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
layout: post
|
||||
title: Developer Journal, End of 2020
|
||||
date: 2020-12-28 07:26:23-0400
|
||||
categories:
|
||||
tags: [programming, project, devjournal]
|
||||
summary: Progress on assorted projects
|
||||
thumbnail: /blog/assets/liquid-black-and-white-wine-glass-motion-celebration-671028-pxhere.com.png
|
||||
offset: -10%
|
||||
---
|
||||
|
||||
![Happy New Year](/blog/assets/liquid-black-and-white-wine-glass-motion-celebration-671028-pxhere.com.png "Happy New Year")
|
||||
|
||||
All the holidays after the solstice tend to blur together. We're at the third day of [Kwanzaa](https://en.wikipedia.org/wiki/Kwanzaa)---*Ujima*, the day of collective work and responsibility---in African-American communities, but we're also coming in on the end of a chaotic year.
|
||||
|
||||
Anyway...
|
||||
|
||||
## Picture-to-Nonogram
|
||||
|
||||
This was the start of my [new little project](https://github.com/jcolag/picture-nonogram), a program to use [ImageMagick](https://imagemagick.org/) in order to create a [nonogram](https://en.wikipedia.org/wiki/Nonogram) puzzle based on an image file.
|
||||
|
||||
The short version on the overall algorithm is (or will be) approximately as follows.
|
||||
|
||||
* Call `identify` on the image to find out its size.
|
||||
* Find the largest common factor of the dimensions in order to reduce the ratio to the smallest equivalent image.
|
||||
* Resize the image to that target size.
|
||||
* Convert the image to black and white with something like `convert smaller.jpg -negate -threshold 66% -negate bw.jpg`
|
||||
* Dump the color of each pixel with `convert bw.jpg txt:`
|
||||
|
||||
From here---which is roughly where the repository currently stands---it's just a matter of [run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding) the black and white pixels in each direction and discarding one set of pixels.
|
||||
|
||||
That's not perfect, of course. It'll need some extra fussing in the second step to make sure that the image isn't collapsed to a size that's far too big or far too small. The code may also need to iterate to find the best threshold setting. But I'll get to that, and---with any luck---eventually turn it into a game.
|
||||
|
||||
## Next
|
||||
|
||||
I'll continue on with **Picture-to-Nonogram**, of course, but don't really have much of a plan beyond that. That might be enough.
|
||||
|
||||
* * *
|
||||
|
||||
**Credits**: The header image is [untitled](https://pxhere.com/en/photo/671028) by an unidentified photographer, released under the terms of the [Creative Commons CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).
|
Loading…
Reference in New Issue