Raw extraction problems with dcraw


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Raw extraction problems with dcraw
# 1  
Old 10-12-2018
Raw extraction problems with dcraw

Hi,


I'm really a newbie in linux system! Please bear with me.
The problem is every time I run the shell script, it deletes all the files in the target directory and left one D source code type file with name: *.ppm.d.

Can anyone help me with this??
Thanks in advance!





what I'm trying to do is:
1. use dcraw to extract all *.raw in one directory. outputs are *.ppm. (The shell script let you type in the directory to work in)

2. remove all *.raw
3. doing a bit image processing with double.c(outputs are *.d)

4. remove all *.ppm files

5. remove *.d extension of all files



Here is the code:

Code:
#!/bin/sh
cd /home/pi/dcraw/
echo "Enter target directory: "
read filename


for file in "$filename/*.raw";
do
./dcraw "$file";
done


cd $filename
rm *.raw


for file in "$filename/*.ppm";
do
double $file > ${file}.d;
done


rm *.ppm


for file in "$filename/*.d";
do
mv -- "$file" "${file%%.d}";
done

# 2  
Old 10-12-2018
Wildcards inside quotes do not expand. How about this:

Code:
#!/bin/sh
cd /home/pi/dcraw/
echo "Enter target directory: "
read filename

for RAW in "$filename"/*.raw
do
        PPM="${RAW/.raw/.ppm}"
        PPMD="${RAW/.raw/.ppm.d}"

        ./dcraw "$RAW"
        double "$PPM" > "$PPMD"
        rm "$RAW" "$PPM"
        mv "$PPMD" "$PPM"
done

I can't find any information on this 'double' utility but it may be possible to do this with no temp files at all if you can tell me what it is.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 10-12-2018
It might work something like ./dcraw -c filename.raw | double /dev/stdin > filename.ppm
# 4  
Old 10-12-2018
the double program is in C. Its just an image processing tool to double the rows of an image, so as to strech it vertically.
Thanks for your help!!!!!!


I ll try your method right away

------ Post updated at 08:43 PM ------

it worked partially. Even though with some warnings.

Seems the double function did not apply.



PPM: not found
PPPMD: not found

cannot create: directory nonexistent
rm: cannot remove no such file or directorry
mv: cannnot stat no such file or directo




Thx!!!

------ Post updated at 08:45 PM ------

I have to ask what does ' |' mean and what is /dev/stdin behind double?
# 5  
Old 10-12-2018
Did you copy Corona688's script char by char, keystroke by keystroke? The $ - signs are important for variable expansion.



The pipe symbol | connects (pipes) one command's standard output (stdout) to another's standard input (stdin). With it, you can construct powerful, versatile compound commands from single simple tools / commands.
/dev/stdin is a (formal) symbolic link to a process' stdin, used in case a command explicitely needs a file name as an argument.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Specify the raw format

Hey friends, i am trying to set up a raspbian wheezy vm on ma Unbuntu using qemu. when i try to run the setup command the error is: i tried to find something here in the forum but did not find anything. i was searching like 15 min pls dont roast me if there is a post explaining it. :)... (3 Replies)
Discussion started by: LinuxPlayer1809
3 Replies

2. Red Hat

Raw Devices

Can you please modify my script. This script is not working for i in /dev/sdf do /bin/raw /dev/raw/`/bin/basename ${i}` ${i} /bin/sleep 2 /bin/chown orasm:ordba /dev/raw/`/bin/basename ${i}` /bin/chmod 660... (9 Replies)
Discussion started by: karthik9358
9 Replies

3. Programming

Raw devices in C

Hi guys. what is the benefits of using raw devices in programming? which applications mostly use raw devices? how can i use raw devices in C programs? is there any system calls or library functions? (1 Reply)
Discussion started by: majid.merkava
1 Replies

4. Filesystems, Disks and Memory

Raw volumes

The query is as follows : A typical server configs when using Oracle or any other type of DB is to install the OS + DB binaries on the internal disks of the relevant server e.g. Disk 1 : OS + SW + DB binaries Disk 2 : Mirror of disk 1 (used for resiliency) Then one uses an external array... (1 Reply)
Discussion started by: kekanap
1 Replies

5. UNIX for Dummies Questions & Answers

Using the Raw command

Hi, What is a Raw command and how does it work? We have to print out a large report from our database numerically and wanted to know how it can be done. :confused: (1 Reply)
Discussion started by: nov_user
1 Replies

6. AIX

Raw I/o

Is there any system call available in AIX to read the size of raw disk? If I use the command "lspv -L",it only gives size of PVs on which file system is there. I need to extract the size raw disk i.e. file system is not there on the disk. Thanks, Megha (6 Replies)
Discussion started by: MeghaV
6 Replies

7. Solaris

About raw partition

Hi I have solaris 8 installed on Intel machine. the disk I have is IDE. I would like to know how can I create a raw partition on an IDE disk. Regards, Raja (2 Replies)
Discussion started by: RajaRC
2 Replies

8. UNIX for Advanced & Expert Users

Raw vs. Filesystem?

Maybe this is the wrong forum to start this debate and I apologize if it is, but I have been wondering for some time which is better to use for a database, raw or filesystem? By better I mean don't just mean better performance but also ease of maintenance, etc. I know that several years ago it... (5 Replies)
Discussion started by: keelba
5 Replies
Login or Register to Ask a Question