You are not logged in.

#426 2014-10-29 10:15:58

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: sxiv - Simple image viewer written in C

I get a segfault with the current -git in 32-bit Arch:

$ sxiv -c
Segmentation fault (core dumped)

Is there a way of forcing the thumbnails to scale to a certain size? Some of them are as big as I ordered, but others are tiny. Maybe some external tool?

Last edited by karol (2014-10-29 10:22:23)

Offline

#427 2014-10-29 13:29:08

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: sxiv - Simple image viewer written in C

karol wrote:

I get a segfault with the current -git in 32-bit Arch:

$ sxiv -c
Segmentation fault (core dumped)

Fixed.

karol wrote:

Is there a way of forcing the thumbnails to scale to a certain size? Some of them are as big as I ordered, but others are tiny. Maybe some external tool?

Are the images themself tiny? Do they match old cache files created by an older version of sxiv, which used smaller thumbnail sizes? Or could it be, that the thumbnails were extracted from the images' EXIF tags?

Offline

#428 2014-10-29 13:39:55

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: sxiv - Simple image viewer written in C

It's a fresh installation but I've cleaned the cache after every step when tinkering with the new scalable thumbnails etc.
Some thumbnails are only small or tiny, others are tiny, small, medium and big. I've used sizes up to ~400 px and at that level only a portion of the thumbnails is displayed at the requested size.
The images are of various quality and size, but they're bigger than 640x480.
I have no idea if the thumbnails were extracted from the EXIF tags or not, I just ran sxiv in thumbnail mode and noticed that the thumbnails for many images don't want to get bigger than ~200px.

Offline

#429 2014-10-30 08:47:09

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: sxiv - Simple image viewer written in C

Some clarifications, that might help: Cleaning the cache with the `-c' flag, does only remove cached thumbnails, whose original images do not exist anymore.
Started normally, when sxiv finds a cache file for a given image, it is taken, no matter what size it is of. The same does apply for thumbnails found in the EXIF tags. When you run vanilla sxiv on a bunch of files and then configure a new maximum thumbnail size, the already created thumbnails do not scale to the new maximum size, even after recompiling and restarting sxiv. Currently you would have to remove the cached thumbnails by hand or force reload the images in sxiv, in order to get them scaled to the new size. And this would not work, if sxiv finds a thumbnail in the EXIF tag, that is smaller than the configured maximum size.

I've tried to solve this issue, by letting sxiv discard cached thumbnails or the ones found in the EXIF tags, if they're smaller than the configured maximum size. The branch 'thumb-resize' does contain the needed changes. Please try it out and see if it solves your issue.

Offline

#430 2014-10-30 14:12:36

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: sxiv - Simple image viewer written in C

I was using 'rm -rf' to remove the contents of the cache directory.
I'll try the 'thumb-resize' branch, thanks.

Offline

#431 2014-10-31 09:46:46

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: sxiv - Simple image viewer written in C

Just a heads-up: I've included new changes into the thumb-resize branch and force-rebased it onto the new master branch. Please make sure to test the current version.

Offline

#432 2014-10-31 10:25:02

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: sxiv - Simple image viewer written in C

Works great, thanks.

The selection border is too thick for large thumbnails, but I can tweak it in thumbs.c myself.

Offline

#433 2014-10-31 12:50:38

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: sxiv - Simple image viewer written in C

karol wrote:

The selection border is too thick for large thumbnails, but I can tweak it in thumbs.c myself.

To what value do you limit the border width? Also, what's the maximum thumbnail size you've configured in your config.h?

Offline

#434 2014-10-31 13:36:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: sxiv - Simple image viewer written in C

I'm using a 1280x1024 monitor and

static const int thumb_sizes[] = { 230, 460 };

gives me a 5x4 or 2x2 thumbnail grid on the screen.
I've changed the border thickness with

    tns->bw = ((thumb_sizes[tns->zl] - 1) >> 7) + 1;

but I don't know C ;P

Offline

#435 2014-11-01 11:40:02

marcoscan
Member
Registered: 2009-04-07
Posts: 36

Re: sxiv - Simple image viewer written in C

@ber_t

Thanks a lot for sxiv, it's great :-)

Last edited by marcoscan (2014-11-01 12:05:35)

Offline

#436 2014-11-20 15:13:23

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxiv - Simple image viewer written in C

gif files are not animating for me at all - I just see the first frame, frozen.

I'm using the default config.h (in fact, I'm using the package in community). sxiv 1.3.1.

[EDIT]

Oh, sorry, I just came across #182. Is there any way to make playing gifs the default (like with GIF_AUTOPLAY)? Also, GIF_LOOP is now ignored. How can I avoid gif for looping? Or has this option been deprecated.

Thanks.

Last edited by hobarrera (2014-11-20 15:31:50)

Offline

#437 2014-11-27 08:21:54

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: sxiv - Simple image viewer written in C

hobarrera wrote:

gif files are not animating for me at all - I just see the first frame, frozen.

GIF animations are now globally toggled with the Ctrl-space key mapping. You can use the `-a' switch to activate them per default, i.e. on startup.

hobarrera wrote:

Is there any way to make playing gifs the default (like with GIF_AUTOPLAY)? Also, GIF_LOOP is now ignored. How can I avoid gif for looping? Or has this option been deprecated.

All the old GIF_ options from config.h have been deprecated and are ignored now. There are only two possible states now, play gif animations looping endlessly or do not play them at all.

Offline

#438 2014-11-29 10:59:17

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: sxiv - Simple image viewer written in C

> GIF animations are now globally toggled with the Ctrl-space key mapping.

That had slipped right past me. Cool, thanks!

> There are only two possible states now, play gif animations looping endlessly or do not play them at all.

That's a shame: I really liked the play-gifs-only-once feature offered. ?

Offline

#439 2014-12-05 10:01:26

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxiv - Simple image viewer written in C

Hi,

I have made another sxiv enhancement.

This one addresses the problem of pencil sketch thumbnails. I scan a lot of pencil sketches, and as you can see here, the result of naively thumbnailing them is nearly useless.

The utility i wrote, 'scanthumber', generates thumbnails that sxiv will use instead. It generates much more legible thumbnails by increasing the contrast and thickening the lines before scaling the image down to make the final thumbnail.
You just pass the filenames of the images you want to generate thumbnails for to it on the commandline, like "scanthumber foo.jpg bar.jpg".

Dependencies are:
* Python 3
* Plumbum (http://pypi.python.org/pypi/plumbum/), available as the AUR package python-plumbum
* GMIC (http://gmic.sf.net) , for general image processing. Available as the community package 'gmic'
* ImageWorsener (http://entropymine.com/imageworsener/),
   to scale the image down in the highest-quality way. Currently has no AUR package.
* Standard Linux/Unix 'file' utility, to determine the image dimensions
* coreutils 'touch' utility, to adjust mtimes on the thumbnails,
   so that sxiv considers them up-to-date.

You can get the code here.

I made Before and after images (viewing the exact same set of images). You can also view that as an Imgur gallery.

Caveats:

* Has not currently been tested with non-jpeg images (eg. png).

Last edited by likytau (2014-12-05 11:38:41)

Offline

#440 2014-12-28 18:10:32

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

Just upgraded from 1.2 to 1.3.1.  I like what you've done.  More features but also simplification.

Thumbnail caching starting on the current page is fantastic.

However should it not then go on to continue caching like it used to?  Currently to cache a whole directory I have to manually page through the files.

How about a way to call sxiv so it will recursively build the thumbnail cache (e.g sxiv --precache ~/Pictures/)

I guess we could write a script to do the same though.....hmm, anyone a scripting wizard?

Offline

#441 2014-12-28 18:51:09

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

And is anyone else finding that sxiv is not caching all the thumbnails?

I just browsed a directory with 32 files and the cache dir only has 13 thumbs.  Hmm

(I have thumbnails set to a single size of 176 in config.h.  I also tried 160, which made it cache more in some cases, but not all)

Offline

#442 2014-12-28 19:02:15

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: sxiv - Simple image viewer written in C

Do the not cached thumbnails belong to pictures smaller than the thumbnail size you requested?

Offline

#443 2014-12-28 19:27:08

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

karol wrote:

Do the not cached thumbnails belong to pictures smaller than the thumbnail size you requested?

No

Offline

#444 2014-12-28 20:47:47

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

My only idea is that it could be EXIF thumbnails being used and so no cache file is written.

Is there a way to turn EXIF thumbnails off?

And my other question about how to get sxiv to cache the whole folder, not just what is on the current screen?

Offline

#445 2014-12-29 23:02:44

drtebi
Member
Registered: 2013-02-09
Posts: 126

Re: sxiv - Simple image viewer written in C

robertpeston wrote:

And is anyone else finding that sxiv is not caching all the thumbnails?

I just browsed a directory with 32 files and the cache dir only has 13 thumbs.  Hmm

(I have thumbnails set to a single size of 176 in config.h.  I also tried 160, which made it cache more in some cases, but not all)

I believe the latest version of sxiv only caches the thumbnails that are actually "in view". So if you open images in thumbs-view, and there are several pages, only the pages that you actually look at (that will appear on the screen when you page through them) will be cached.

Once I realized this, and made sure to page through all thumbs and also wait until they are all loaded, I had no problems with the caching. I know this for sure because I am using the sxiv thumbs for another application that I am working on...

I hope that helps and works for you.

Offline

#446 2014-12-30 00:04:46

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

drtebi wrote:

I believe the latest version of sxiv only caches the thumbnails that are actually "in view". So if you open images in thumbs-view, and there are several pages, only the pages that you actually look at (that will appear on the screen when you page through them) will be cached.

Once I realized this, and made sure to page through all thumbs and also wait until they are all loaded, I had no problems with the caching. I know this for sure because I am using the sxiv thumbs for another application that I am working on...

I hope that helps and works for you.

That was my point.  I realised it was doing it page by page (which is for me, undesirable.  I used to simply leave sxiv for a few minutes, then I could browse quickly the cached thumbs).  With a folder with 32 images (so all on one page) I was getting 17 or 22 or some other number depending on the size chosen.  All images were larger than the thumbs.  I'm stumped.

Offline

#447 2014-12-30 06:51:24

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: sxiv - Simple image viewer written in C

robertpeston, there is no noticeable downside to having multiple thumb sizes, as the smaller sizes are generated at load time; the cached thumbnail is always of maximum size. This is useful if you want to force thumbnails to load, as you can include a very small size that you can zoom out to, for example

static const int thumb_sizes[] = {8, 176}

Obviously, 8x8 thumbnails will fit a LOT of images on one page. I have a minimum thumbnail size of 32, and this fits 800-odd thumbs into a fullscreen sxiv window; by extrapolation, 12800 (800 * 4 * 4) thumbnails should be shown with 8x8 thumbs.

I realize this does not address your immediate problem that not all thumbnails are cached.
You have a theory that the EXIF thumbnails are being used instead, right? Here is a shell function that will check all
files it is passed for exif thumbnails, and print those that possess them:

hasexifthumb() {
for V; do
  SIZE=$(exiftool -thumbnailimage -b "$V" | wc -c)
  if [ "$SIZE" -gt 0 ]; then
    echo "$V"
  fi
done
}

You could check how many of your files in a directory have exif thumbs using this with wc -l, as in 'hasexifthumb * | wc -l'.
I hope this helps you narrow down what is actually happening.

Offline

#448 2014-12-30 14:46:50

robertpeston
Member
Registered: 2013-10-23
Posts: 16

Re: sxiv - Simple image viewer written in C

likytau wrote:

You could check how many of your files in a directory have exif thumbs using this with wc -l, as in 'hasexifthumb * | wc -l'.
I hope this helps you narrow down what is actually happening.

It does.  I'll get on it.  Thank you!

Edit:

tried

    thumb_sizes[] = { 8, 176 };

and

    thumb_sizes[] = { 8, 160 };

and there is definitely a change in behaviour.  Sometimes at 176, no thumbnails are written at all, whereas at 160, nearly the whole folder is written,  The images are all bigger than 160 pixels.

Last edited by robertpeston (2014-12-30 15:03:48)

Offline

#449 2015-01-01 04:30:02

drtebi
Member
Registered: 2013-02-09
Posts: 126

Re: sxiv - Simple image viewer written in C

robertpeston wrote:
drtebi wrote:

I believe the latest version of sxiv only caches the thumbnails that are actually "in view". So if you open images in thumbs-view, and there are several pages, only the pages that you actually look at (that will appear on the screen when you page through them) will be cached.

Once I realized this, and made sure to page through all thumbs and also wait until they are all loaded, I had no problems with the caching. I know this for sure because I am using the sxiv thumbs for another application that I am working on...

I hope that helps and works for you.

That was my point.  I realised it was doing it page by page (which is for me, undesirable.  I used to simply leave sxiv for a few minutes, then I could browse quickly the cached thumbs).  With a folder with 32 images (so all on one page) I was getting 17 or 22 or some other number depending on the size chosen.  All images were larger than the thumbs.  I'm stumped.

OK, I figured that you pretty much described the same slight annoyance as I have experienced with the latest sxiv.

It would probably be a good idea to contact the developer directly, and ask for a feature in the config.h file that allows to disable dynamic caching. I would really appreciate that too...

Offline

#450 2015-01-04 20:54:23

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: sxiv - Simple image viewer written in C

I've made sxiv cache out of view thumbnails. In this regard it should behave like the previous version; however it loads into and keeps in memory only the thumbnails that are in view, and it loads all in view thumbnails before it continues caching the out of view ones.
With the current version--as with the current HEAD--sxiv does not cache thumbnails that are smaller than the maximum configured size. I do not plan to change that, as it enables sxiv to adapt to a reconfigured bigger maximum thumbnail size. In the previous version, sxiv would use the old ones, which caused it to display thumbnails that were too small.

Offline

Board footer

Powered by FluxBB