mobian, pinephone camera, and megapixels
#11
(03-25-2021, 02:56 PM)Maus Wrote: I'm sorry to read you lost your images, but you are absolutely right, reading only the introductory comment lines, especially the last two of them, would have helped:

# The post-processing script is responsible for cleaning up
# temporary directory for the burst.

<snip>

Thanks, Maus! Yeah, I'm not much of a script meister so sometimes I take heuristic shortcuts to study behavior rather than studying the code. I've been in computing since before "microcomputers" even existed. FORTRAN, K&R C, and assembler is mostly how I learned a living many years ago.

But at least I finally settled into reviewing the code and I found the bug. I guess it's best to stick to POSIX syntax when using sh and perhaps a new intolerance to legacy code just bit postprocess.sh!

I changed line 69 in postprocess.sh from
Code:
if [ "$CONVERT" == "convert" ]; then

to

Code:
if [ "$CONVERT" = "convert" ]; then
I setup test subdirectories and ran the script from the terminal and it worked only with the change in operator syntax. I have .jpg files now! Big Grin

From https://stackoverflow.com/questions/2044...erators-eq

== is a bash-ism, by the way. It's better to use the POSIX =. In bash the two are equivalent, and in plain sh = is the only one guaranteed to work.

Now I need to discover where to file a bug report.
  Reply
#12
(03-25-2021, 04:53 PM)calinb Wrote: But at least I finally settled into reviewing the code and I found the bug. I guess it's best to stick to POSIX syntax when using sh and perhaps a new intolerance to legacy code  just bit postprocess.sh!

Great find! The funny thing is, just a week ago I sort of lectured interpreter agnostic shell scripting to my apprentice, with exactly this as a common example, but I didn't spot the problem here ... I'm also getting older every day.

This has already been fixed by Martijn, and will probably land in Mobian soon.
  Reply
#13
(03-26-2021, 01:38 AM)Maus Wrote: Great find! The funny thing is, just a week ago I sort of lectured interpreter agnostic shell scripting to my apprentice, with exactly this as a common example, but I didn't spot the problem here ... I'm also getting older every day.

This has already been fixed by Martijn, and will probably land in Mobian soon.

Thanks for the comment and link to Martijn's latest code. Lacking a way to file a bug report, I sent Martijn an email and apparently he fixed the script very promptly (9 hours ago)!
  Reply
#14
As graphicsmagick compatibility has been added I tried swapping imagemagick for graphicsmagick and this also works as a quick fix, just in case..
  Reply
#15
(03-26-2021, 04:18 AM)battlegarden Wrote: As graphicsmagick compatibility has been added I tried swapping imagemagick for graphicsmagick and this also works as a quick fix, just in case..

Yes. Good point. After the script's existence test for imagemagick errors, due to the bash-ism, it will use gm, if installed. I've not looked into gm but maybe it's a better choice than im for this usage anyway, because I suspect gm may be a lighter weight program and the im GUI doesn't seem terribly usable on PinePhone Mobian to me.

But, for the first time, I'm now getting .jpg files in my Pictures folder using Megapixels so "if it works, don't fix it" is the approach I'm sticking-with! Wink
  Reply
#16
Hello there,

has anyone found out how to tell megapixels where to store the jpegs? In my case, it's plain $HOME and I want to change it (back) to $HOME/Pictures.

Thanks in advance!

Cheers!
  Reply
#17
(03-26-2021, 05:20 AM)arno_nuehm Wrote: has anyone found out how to tell megapixels where to store the jpegs? In my case, it's plain $HOME and I want to change it (back) to $HOME/Pictures.

This is determined programmatically here. I' not sure how files could end up directly in $HOME, though. If the environment is sane, files should show up in (a localised version of) $HOME/Pictures. Perhaps you changed your locale to something non-English and it would have saved to $HOME/Eikones (for example) if only the folder would have existed ... but the last else would have catched that!
  Reply
#18
(03-26-2021, 05:20 AM)arno_nuehm Wrote: Hello there,

has anyone found out how to tell megapixels where to store the jpegs? In my case, it's plain $HOME and I want to change it (back) to $HOME/Pictures.

Thanks in advance!

Cheers!

Megapixels passes the folder and filename (without extension) as arguments to postprocess.sh and I don't know how to configure this megapixels behavior but there's probably a configuration file that will do it. Maybe have a look at the source code at the link posted by Maus above or maybe someone here knows how to do it.

I see no files in /home/mobian/.config/megapixels but it might be the location where such a configuration file would go and you just need to create a valid configuration file.

If you can't find a megapixels configuration solution, you could modify the postprocess.sh script to move the files (*.jpg or whatever) from $HOME to $HOME/Pictures after they are written.
  Reply
#19
I just used Megapixels for the first time months while and I'm finding it's producing dng files instead of the jpg format it was previously saving. (A couple of pictures I took and saved back in January with Megapixels are in jpg format.) Both dcdraw and imgmagick are installed. Also, what exactly does Megapixels do with the QR code? I can see it zeroing in on the code and there's some tiny text which I assume is the decoded content, but all it seems to actually do is save the QR as a dng image. What does it do with the QR code data?

EDIT: In another thread I was informed that tapping the screen copies the QR code data - puts it into the paste buffer? How to retrieve it or use it?
  Reply
#20
(04-28-2021, 02:39 PM)Zebulon Walton Wrote: I just used Megapixels for the first time months while and I'm finding it's producing dng files instead of the jpg format it was previously saving. (A couple of pictures I took and saved back in January with Megapixels are in jpg format.)
<snip>

Zebulon,

I found this bug (non-POSIX syntax in the /usr/share/megapixels/postprocess.sh). Then I patched my script and reported it to Martijnj. He promptly squashed the tiny (but deadly bug) in his source. I guess it still hasn't rolled out in a Mobian update / upgrade yet?

All you need to do is change == to = to make postprocess.sh work, like this:

Code:
- if [ "$CONVERT" == "convert" ]; then

+ if [ "$CONVERT" = "convert" ]; then

As documented here:
https://git.sr.ht/~martijnbraam/megapixe...process.sh

I thought I described my fix in my last posts in this thread (after mucking my way through the debug effort).

I get .dng and .jpg now so I need to double check that you have the same helper aps that I'm using, which I'll do later today.

-Cal
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  bookworm vs trixie discussion for mobian in pinephone regular. zetabeta 36 7,064 09-25-2024, 12:41 AM
Last Post: zetabeta
  The program doesn`t detect the camera blag0rag 6 1,286 09-17-2024, 03:45 PM
Last Post: Kevin Kofler
  atinout binaries for mobian/debian? NeutralGrey 3 1,066 08-07-2024, 04:27 AM
Last Post: baptx
  Pinephone seems tobe using 4G data instead of Wifi data grump_fiddle_reinstall 1 652 06-25-2024, 10:38 AM
Last Post: mikehenson
  Mobian-Kicksecure? 3460p 0 682 05-26-2024, 02:09 PM
Last Post: 3460p
  Mobian repository status henrythemouse 16 11,442 04-10-2024, 10:02 AM
Last Post: diederik
  cant verify mobian image at website gnugpg penguins_rule 0 748 03-18-2024, 08:54 PM
Last Post: penguins_rule
  unofficial kali linux for pinephone help needed pinesmell 5 4,821 01-08-2024, 02:50 PM
Last Post: ERPlegend
  mobian installed to eMMC - how to install tow-boot grump_fiddle_reinstall 6 3,627 11-22-2023, 11:46 AM
Last Post: aLoop100o
  What actions needed to keep on mobian testing user641 3 2,418 09-05-2023, 06:44 AM
Last Post: Zebulon Walton

Forum Jump:


Users browsing this thread: 1 Guest(s)