The question of what legally counts as a single derivative work, as opposed to a collection of separate works, is in fact mostly a red herring in this case. The reason for this is that, as long as your software includes any part that has been created by another person, or recognizably derived from something created by another person, you will need that person's permission to distribute it.*
Usually, in the Open Source world, that permission will come in the form of a written license — and the license will specify the conditions that you must abide by, in order to be allowed to distribute your software (or, rather, the parts of your software whose copyright belongs to the licensor and is covered by the license):
If the license requires you to credit the original author of the code, you must do so, or not distribute the code covered by the license.
If the license requires you to release some of your own code under the same license, you must do so, or not distribute the code covered by the license.
If the license requires you to release all of your own code under the same license, you must do so, or not distribute the code covered by the license.
If the license requires you to translate your documentation into Lojban and post it on Usenet, you must do so, or not distribute the code covered by the license.
If the license requires you to stand on your head for 5 minutes every Friday, while meditating upon the meaning of the word foobar, you must do so, or not distribute the code covered by the license.
Of course, some of those demands are more reasonable than others, but the person who holds the copyright to the code you're using is allowed to make any of them,** as a condition of allowing you to redistribute their code (or a derivative of it). Your options, meanwhile, are basically Hobson's choice: take it or leave it.
If the original author has released their code under multiple alternative licenses, then of course you only need to comply with (at least) one of them. And even if they haven't, you do always have the option of contacting the copyright holder (or their heirs, should they have become, um, permanently unreachable) and asking to negotiate a new license agreement with terms you find more agreeable. Of course, they always have the option of saying no.
*) The main exception to this is that, if your use of the other person's work is covered by fair use or other similar permissions granted directly by applicable law, then you're not actually infringing the other person's copyright, and therefore do not need their permission.
**) Depending on local laws, a court might rule some requirements in a license to be illegal or unenforceable. For example, I'm pretty sure that a license that only allowed e.g. white heterosexual males to use and redistribute the software would fall foul of anti-discrimination laws in many if not most jurisdictions. What actually would happen at that point is a complex matter of local law, license wording and judicial discretion, but basically, while it's possible that the court would simply strike out the offending restriction, it's just as likely that they might rule the whole license to be void, thereby preventing anyone (except the original author) from legally distributing works licensed under it.
"Copyleft", "ShareAlike" or "viral" licenses, which require your work to be released under the same license terms as the original work you've used as part of it, generally define more or less explicitly how broadly this requirement is meant to be interpreted. For example, the GPLv3 contains the following wording:
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
[…]
- c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
[…]
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
This does not actually explicitly define what counts as a "work" (and no such explicit definition appears elsewhere in the license, either), but the last paragraph does explicitly exempt "aggregates" of independent programs from the Copyleft aspect of the GPL, which strongly implies that the authors of the GPL did intend it to cover any combined works that include a GPLed component and which do not meet the definition of an "aggregate" quoted above.
In particular, while IANAL, I'm fairly sure that the "separate and independent" and "not combined with it such as to form a larger program" clauses are enough to disqualify your image viewer from being an aggregate as defined by the GPL. Thus, using a GPLed zip library (with or without modifications) in your image viewer would force you to abide by the terms of the GPL (including, but not limited to, its Copyleft requirements) when distributing your image viewer.
The GPL FAQ also includes some relevant statements (which, while not actually part of the license, a judge might well take into account in interpreting the intent of its authors), including the following:
What is the difference between an “aggregate” and other kinds of “modified versions”? (#MereAggregation)
An “aggregate” consists of a number of separate programs, distributed together on the same CD-ROM or other media. The GPL permits you to create and distribute an aggregate, even when the licenses of the other software are nonfree or GPL-incompatible. The only condition is that you cannot release the aggregate under a license that prohibits users from exercising rights that each program's individual license would grant them.
Where's the line between two separate programs, and one program with two parts? This is a legal question, which ultimately judges will decide. We believe that a proper criterion depends both on the mechanism of communication (exec, pipes, rpc, function calls within a shared address space, etc.) and the semantics of the communication (what kinds of information are interchanged).
If the modules are included in the same executable file, they are definitely combined in one program. If modules are designed to run linked together in a shared address space, that almost surely means combining them into one program.
By contrast, pipes, sockets and command-line arguments are communication mechanisms normally used between two separate programs. So when they are used for communication, the modules normally are separate programs. But if the semantics of the communication are intimate enough, exchanging complex internal data structures, that too could be a basis to consider the two parts as combined into a larger program.
Of course, some people may find this requirement of the GPL too onerous, specifically in situations like yours. For that reason, the FSF also created the LGPL, which is a modification of the GPL that explicitly permits linking an LGPLed software library with other code (under specific conditions) without requiring the other code to be (L)GPLed as well.
If the zip library you were using was released under the LGPL, you could release your image viewer using it under any license terms you wanted, provided that you still followed all the requirements that the LGPL does impose on you, such as
1) to release any actual modifications you made to the zip library under the (L)GPL and make their source code available,
2) to include the copyright notice of the library among any such notices displayed by your program, and
3) to make it possible for users to re-link your software with modified versions of the library (e.g. by using dynamic run-time linking).
As for Creative Commons licenses, the legal text of the CC-By-SA 4.0 Unported license defines "Adapted Material" as follows:
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Except for the specific case of synching audio with video, this definition seems to mostly punt the question back to local law, as the Creative Commons FAQ confirms:
When is my use considered an adaptation?
Whether a modification of licensed material is considered an adaptation for the purpose of CC licenses depends primarily on the applicable copyright law.
[…]
This basically means that no globally valid answer can be given without considering the details of every country's copyright law (and relevant precedents in case law). And even then, the answer in many cases would likely be that it would be up to the judge to decide, were the issue to ever come before one.
Ps. Curiously, the earlier version 3.0 of CC-By-SA does explicitly exclude "Collections" of independent works, as defined in section 1 of the license, from being "Adaptations" (to which the ShareAlike license element applies). Looking at the CC 4.0 draft pages on the Creative Commons wiki (specifically, in the collapsed sections on Drafts 1 & 2), it seems that this definition was deemed redundant and unnecessary, and thus removed from the CC 4.0 licenses. In any case, this does not seem to constitute a substantive change between the licenses, nor to have been intended as one.